← Back to team overview

sikuli-driver team mailing list archive

[Bug 1079319] Re: Comment line throws a syntax error

 

This is not a bug, it is a feature ;-)

I admit, that especially the SyntaxError messages from Python/Jython are something you have to get used to:
In this case you used a ' inside a string, that is quoted with '

the solution:
if len(sys.argv)==0 or "C:/Documents and Settings/nidemers/My Documents/Sikuli Projects/MFW Response Rec'd.sikuli/" != sys.argv[0]: sys.argv.insert(0, "C:/Documents and Settings/nidemers/My Documents/Sikuli Projects/MFW Response Rec'd.sikuli/")

use " if the string contains ' and vice versa.

this is a syntax error, because the inner ' ends the string and the
directly following d (mismatched input 'd' expecting COLON)  causes the
error (I guess they talk about mismatched, because the d does not fit
with any internally used regular expression)

So it has nothing to do with the comment.

--- Would it be possible to get sikuli to enforce proper naming or possibly have a clearer error message in the future?
Since we will not rewrite the Python syntax checker: nothing to do here.

The error message itself in Sikuli will be a bit more compact and
structured in the future.

** Changed in: sikuli
       Status: New => Won't Fix

** Changed in: sikuli
     Assignee: (unassigned) => RaiMan (raimund-hocke)

** Changed in: sikuli
    Milestone: None => x1.0

** Summary changed:

- Comment line throws a syntax error
+ Python SyntaxError message hard to understand

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1079319

Title:
  Python SyntaxError message hard to understand

Status in Sikuli:
  Won't Fix

Bug description:
  This line of comments:

  #In order to run this script the spreadsheet for MFW must be open
  already.

  Caused this error:

  [error] Stopped
  [error] An error occurs at line 1
  [error] Error message: SyntaxError: ("mismatched input 'd' expecting COLON", ('', 1, 112, "if len(sys.argv)==0 or 'C:/Documents and Settings/nidemers/My Documents/Sikuli Projects/MFW Response Rec'd.sikuli/' != sys.argv[0]: sys.argv.insert(0, 'C:/Documents and Settings/nidemers/My Documents/Sikuli Projects/MFW Response Rec'd.sikuli/')\n"))

  
  It turns out it's because I had an apostrophe in the name of the sikuli folder. The script thought that the 'd at the end of the name was part of the programming.

  Would it be possible to get sikuli to enforce proper naming or
  possibly have a clearer error message in the future?

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1079319/+subscriptions


References