[error] --- Traceback --- end --------------

Asked by Leonardo Carvalho Sobral dos Santos

Hi,

I 'm having some problems in my script...

I don't have any idea whats happening that a traceback is happening

....Thats the part of my script....

(LINE 1 TO 6)
def printScreen(filename):
    try:
        import shutil
        shutil.move(capture(SCREEN),filename)
    except:
        raise exception

HERE, i'm having problem

testOk = 0;
testNok = 0;

try:

    openTrackingItem()
    print("Test 1 - Passed")
    filename = "Test01Passed.png"
    printScreen(filename)
    testOk = testOk +1;

except:

    print("Test 1 - Failed")
    filename = "Test01Failed.png"
    printScreen(filename) <--------
    testOk = testNok +1;

[error] script [ *Sanity_ePM ] stopped with error in line 60
[error] NameError ( global name 'exception' is not defined )
[error] --- Traceback --- error source first line: module ( function ) statement 6: main ( printScreen ) raise exception
[error] --- Traceback --- end --------------

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

raise Exception

The predefined Python exception class names have to be written as defined.
Since they are classes, they are written with capital first letter.

Revision history for this message
Leonardo Carvalho Sobral dos Santos (leonardocsobral) said :
#2

I re-installed and the error stopped.

Revision history for this message
Leonardo Carvalho Sobral dos Santos (leonardocsobral) said :
#3

I think i discovered.

When I run the script more than once, application take a pic of latest screen. The SS is saved but if script run more than once, the new SS doesn't override the old one. THIS SCENARIO MAKE the ERROR

Revision history for this message
obiwan-92 (obiwan-92) said :
#4

Hello,

I'm sorry, I don't understand what you ask.
Can you be a little more accurate :
What do you want to do ?
What is wrong ?

Best regards.

Can you help with this problem?

Provide an answer of your own, or ask Leonardo Carvalho Sobral dos Santos for more information if necessary.

To post a message you must log in.