Import Error: Expecting Newline

Asked by Carol-Sue M

I have created a "utility" class that can be called from multiple scripts. It is call "cUtil.sikuli"

from sikuli import *
from ConfigParser import *

class cUtil:
     def readConfig(self):
        .
        .
        .
       return;

and so on.
----------------------------------------------
I have a main script called "AutoTest" where I am calling certain functions from the class. It starts:

from sikuli import *
myScriptPath = "C:\\Sikuli\\cUtil.sikuli"
from cUtil import *
-----------------------------------------------------------
Both scripts are found in the C:\Sikuli directory, but when I run AutoTest, I receive:

[error] Stopped
[error] An error occurs at line 5
[error] Error message: Traceback (most recent call last):
File "C:\Windows\Temp\sikuli-tmp6604384538494479748.py", line 5, in
from cUtil import *
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\SikuliImporter.py", line 45, in load_module
File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\SikuliImporter.py", line 29, in _load_module
ImportError: Errors in loading sikuli module: cUtil
mismatched input '=' expecting NEWLINE (cUtil.py, line 5)
- HOW TO FIX? Try adding "from sikuli import *" in the module.
-----------------------------------------------------------
Any help you could give me would be greatly appreciated.

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

Seems to be a syntax error in cUtil at line 4, 5 or 6 with some = sign near end of line.

Revision history for this message
Carol-Sue M (cmcilhargey) said :
#2

It seems to be choking at:

def readConfig(self):
       config = ConfigParser.ConfigParser()
       config.read("C:\\Sikuli\\AutoTest.sikuli\\config.ini")

____________________

 I have confirmed that the ini file is there and that the path is correct. I also confirmed that the file was closed. Any suggestions?

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

Please paste more code.

Can you help with this problem?

Provide an answer of your own, or ask Carol-Sue M for more information if necessary.

To post a message you must log in.