Windows 64-Bit / Eclipse: "no attribute 'getEnviron' in module os" reported at Sikuli startup

Asked by Landy

***** worth a try
might be a bug in Jython 2.5.2
so going back to Jython 2.5.1 might solve the problem.
see comment #4 below
----------------------------------------------------------------------------------

I've read the instruction - http://sikuli.org/docx/faq/040-other-ide.html and did it step by step, but when I run the first script, I still get the error message:

*sys-package-mgr*: processing new jar, 'C:\Program Files (x86)\Sikuli X\sikuli-script.jar'
error importing site
Traceback (most recent call last):
  File "C:\Program Files (x86)\Sikuli X\Lib\site.py", line 62, in <module>
    import os
  File "C:\Program Files (x86)\Sikuli X\Lib\os.py", line 904, in <module>
    environ = sys.getEnviron()
AttributeError: '<reflected field public org.python.core.PyObject o' object has no attribute 'getEnviron'

My environment:
C:\\Downloads>java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

C:\Downloads>jython -V
Jython 2.5.2

eclipse 3.6 32bit

Thanks.

Question information

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

I admit, that the recipe was not tested on a 64-Bit Windows system, what you are running on.

Have you made the plain interactive Jython test from command line?

If this works, please enter the same statements in a PyDev project in Eclipse and run it (no: from sikuli.Sikuli import *).

If this runs, make the following Sikuli script test in Eclipse:

import sys
print "before Sikuli"
for e in sys.path: print e
from sikuli.Sikuli import *
print "after Sikuli"
for e in sys.path: print e

You may send the the output of the 3 tests in separate text files as attachments to my mail at https://launchpad.net/~raimund-hocke. I will have a look at it.

Revision history for this message
Landy (landy-zhu) said :
#2

@Railman

1. Yes, I run the test code from command line (plain interactive Jython). P.S.: looks like the sample test code has a minor issue - "import os" should be "import sys". The output is
C:\Users\XXXX\Downloads>jython
Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for e in sys.path: print e
...

C:\jython2.5.2\Lib
__classpath__
__pyclasspath__/
C:\jython2.5.2\Lib\site-packages
>>>

2. If I doesn't configure the PyDev with Sikuli, the same code can run in a PyDev project in Eclipse. The output is

C:\Users\XXXX\workspace\a\src
C:\eclipse\dropins\plugins\org.python.pydev_2.0.0.2011040403\PySrc
C:\jython2.5.2\Lib
C:\jython2.5.2\Lib\site-packages
C:\Program Files\Java\jre6\lib\resources.jar
C:\Program Files\Java\jre6\lib\rt.jar
C:\Program Files\Java\jre6\lib\jsse.jar
C:\Program Files\Java\jre6\lib\jce.jar
C:\Program Files\Java\jre6\lib\charsets.jar
C:\Program Files\Java\jre6\lib\ext\dnsns.jar
C:\Program Files\Java\jre6\lib\ext\localedata.jar
C:\Program Files\Java\jre6\lib\ext\sunjce_provider.jar
__classpath__
__pyclasspath__
__pyclasspath__/

One interesting thins is the output refer to "C:\Program Files\Java\jre6\lib/xxxxx", but actually this folde is empty. I've uninstalled 64 bit jre and installed 32 bit jre before I install Jython 2.5.2.

3. If I configure the PyDev project with Sikuli, the same code can't run (no "from sikuli.Sikuli import *). The same error message output as I posted above.

Thanks.

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

Your Eclipse/PyDev seems not to be aware of your uninstall64/install32 action,
since the path to Java should be c:\Program Files (x86)\..., where the JRE 32-Bit should be.

But this should not matter for the problem. I will have a look for it on my 64-Bit Windows.

Revision history for this message
Best Raniero Virgilio (vraniero) said :
#4

Hi,

apparently we had the same problem on a 32 bit machine.
We solved it by going back to Jython 2.5.1.

Rgds,
Raniero

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

Thanks for the feedback. I put it in the top.

Revision history for this message
Landy (landy-zhu) said :
#6

Thanks Raniero Virgilio, that solved my question.

Revision history for this message
Landy (landy-zhu) said :
#7

@Raniero, thanks for your solution. I go back to Jython 2.5.1 and the problem is solved! It might a bug of sikuli.