[RC3] the Sikuli IDE cann't Import xlrd or xlwt module

Asked by can

I tried it on this way(faq #2208).

When Sikuli IDE first starts, and then type "import xlrd/import xlwt" and run. It reports error lisk this.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.

[info] VDictProxy loaded.

[error] 被停止
[error] 第1行发生错误
[error] 错误信息: Traceback (most recent call last):
 File "C:\Users\kkk\AppData\Local\Temp\sikuli-tmp531252314093970137.py", line 1, in
 import xlrd
SyntaxError: ('no viable alternative at input \'"PK\\x03\\x04"\'', ('D:\\Program Files\\Sikuli X\\Lib\\xlrd\\__init__.py', 397, 16, ' if peek == b"PK\\x03\\x04": # a ZIP file\n'))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.

[info] VDictProxy loaded.

[error] 被停止
[error] 第1行发生错误
[error] 错误信息: Traceback (most recent call last):
 File "C:\Users\kkk\AppData\Local\Temp\sikuli-tmp7169738656168094645.py", line 1, in
 import xlwt
SyntaxError: ("'import *' not allowed with 'from .'", ('D:\\Program Files\\Sikuli X\\Lib\\xlwt\\__init__.py', 9, 0, ''))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

But run again, Sikuli IDE doesn't report error.It works well.

Here are the versions I tried:
Sikuli 1.0rc3(930)
windows 7 64bit
xlrd-0.7.9
xlwt-1.0.0

I downloaded the Sikuli-1.1.0-20150914.231031-164 and tried to import xlwt or xlrd module, but has failed to import.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[error] script [ 1232 ] stopped with error in line 1
[error] SyntaxError ( ('no viable alternative at input \'"PK\\x03\\x04"\'', ('D:\\Program Files\\Sikuli_1.1.0\\sikulix.jar\\Lib\\xlrd\\__init__.py', 397, 16, ' if peek == b"PK\\x03\\x04": # a ZIP file\n')) )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any idea where I did wrong? Thanks!

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
RaiMan (raimund-hocke) said :
#1

switch to version 1.1.0 (http://sikulix.com)

... it has xldd and xlwt bundled already

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

sorry:

... it has xlrd and xlwt bundled already

Revision history for this message
can (ting) said :
#3

I try to switch to the latest version( Sikuli-1.1.0-20150914.231031-164 )
But it report a similar error.
I don't know how to solve this problem.Need help!

Revision history for this message
can (ting) said :
#4

Sikuli 1.1.0 reports error:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[error] script [ 1232 ] stopped with error in line 1
[error] SyntaxError ( ('no viable alternative at input \'"PK\\x03\\x04"\'', ('D:\\Program Files\\Sikuli_1.1.0\\sikulix.jar\\Lib\\xlrd\\__init__.py', 397, 16, ' if peek == b"PK\\x03\\x04": # a ZIP file\n')) )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

since I cannot reproduce the problem (Jython interpreter does not accept the binary string notation b"..."), it looks like you are not using the builtin Jython 2.7, but somehow an older version of Jython 2.5.x, that comes with the older Sikuli versions.

When using 1.1.0 take care, that no pointers to older Sikuli stuff in the environment, java class path nor in python path.

Revision history for this message
can (ting) said :
#6

Thanks RaiMan, that solved my question.

Revision history for this message
can (ting) said :
#7

Thanks for the hint.

Now I uninstall the old version, including jdk 6, sikuli 1.0rc3 and python 2.7.0.
And delete the jdk class path, sikuli path and python path.

When I download the laster version and install, including jdk 8 and sikuli-1.1.0-20150916.230958-166.
Sikuli 1.1.0 installation path have changed this time. (../sikuli 1.1.0->../sikulix)
It work well.