cannot import another module

Asked by shaihulud

Very strange as I have had no problems before. I Have a test suite file from which I execute different tests from different modules.

The test suit code is:
Import module
module.test()

And the module:
from sikuli import *
def test():
    print ("this is the test")

When I run the testsuite for some reason it stops a the first line with the error text:
[error] SyntaxError ( !!WHILE IMPORTING!! Non-ASCII character in file 'C:\Users\****\Documents\SikuliTests\TestTrialSikuli\Medborgare.sikuli\Medborgare.py', but no encoding declared; see http://www.python.org/peps/pep-0263.html for details )

Question information

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

And this is even weirder but might have a connectiont: when I try to save it says
[error] SikuliIDE: Problem when trying to invoke menu action doSave Error: null
But it does save!

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

Do you have some non-ASCII characters in your file path?

Hoping the 4 stars are for hiding something here:
C:\Users\****\Documents\SikuliTests\TestTrialSikuli\Medborgare.sikuli\Medborgare.py

If this is true, check the Medborgare.py file for non-ASCII characters.
If you edited the file with an external editor, take care to save it withUTF-8 encoding.

Revision history for this message
shaihulud (cal-a) said :
#3

That was it, in the "Medborgare" test i pasted "övervaka"
This does pose a big problem thou since the software under test is in swedish and it would be very nice (but not crucial) to paste "åäö" into the software....
Is there a workaround you can think of?

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

Sikuli completely supports UTF-8 strings.
So a --keyboard typed-- string containing unicode characters should work.

That pasting such stuff in the IDE GUI leads to problems, is at least something to be further checked.

A workaround is of course, to make sure, that the string is already UTF-8 encoded when adding it to clipboard.

Revision history for this message
shaihulud (cal-a) said :
#5

Thanks RaiMan, that solved my question.