SyntaxError: how to find out, what's wrong

Asked by Sebastian Howe

No matter how simple the script, whenever I try to run itI get the error message:
[error] An error occurs at line 1
[error] Error message: SyntaxError: ("mismatched input 's' expecting COLON", ('', 1, 39, "if len(sys.argv)==0 or 'C:/Users/******/Documents.sikuli/' != sys.argv[0]: sys.argv.insert(0, 'C:/Users/******/Documents.sikuli/')\n"))
I have already tryed moving the Sikuli file location but that has not helped at all. Any suggestions would be much appreciated.

Question information

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

This is how to analyze syntax errors:

if len(sys.argv)==0 or 'C:/Users/******/Documents.sikuli/' != sys.argv[0]: sys.argv.insert(0, 'C:/Users/******/Documents.sikuli/')

line 1------------------------------------------^39

something in the part, that you have star-ed is syntactically wrong, so that the character 's' at position 39 mismatches (does not match any syntactically correct construct).

Might be that there is a ' inside the pathname in the star-ed part.
But I cannot tell you, because of the stars ;-)

Revision history for this message
RaiMan (raimund-hocke) said :
#2

the line break in the comment might irritate, so again:

statement in line 1:
if len(sys.argv)==0 or 'C:/Users/******/Documents.sikuli/' != sys.argv[0]: #..... more
line 1------------------------------------------^pos39

Revision history for this message
Sebastian Howe (sebastianthowe) said :
#3

Is there any way I could fix this?

Revision history for this message
Sebastian Howe (sebastianthowe) said :
#4

The starred part is only 5 characters long, and does not contain an s

Revision history for this message
Sebastian Howe (sebastianthowe) said :
#5

ohhhhhhhhhhhhhhhhhhhhhhhhh I get it now, there was an apostrophe, thanks