[1.0] SCREEN.capture() is broken (__builtin__ is not defined)

Bug #845744 reported by Tomasz Kontusz on 2011-09-09
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sikuli
Critical
RaiMan

Bug Description

Sikuli versions: r872 and X 1.0rc2
OS: Ubuntu Natty i686

When running a script in IDE I'm getting:

[info] Sikuli vision engine loaded.

[info] VDictProxy loaded.

[error] Stopped
[error] An error occurs at line 7
[error] Error message:
Traceback (most recent call last):
 File "/tmp/sikuli-tmp612365182765918075.py", line 7, in
 shutil.move( SCREEN.capture( SCREEN.getBounds() ),
 File "/home/chatul/sikuli/Sikuli-r872-linux-i686/Sikuli-IDE/sikuli-script.jar/Lib/sikuli/Screen.py", line 61, in capture
NameError: global name '__builtin__' is not defined

Tomasz Kontusz (tomasz-kontusz) wrote :

adding import __builtin__ to sikuli-script.jar/Lib/sikuli/Screen.py fixes it

Changed in sikuli:
status: New → Fix Committed
Tsung-Hsiang Chang (vgod) wrote :

Fixed. Thanks!

Changed in sikuli:
milestone: none → x1.0-rc3
RaiMan (raimund-hocke) on 2013-02-21
Changed in sikuli:
status: Fix Committed → Fix Released
Ryan Paterson (ryan-paterson) wrote :

I hit a similar error in the latest Sikuli version. It appears that "import __builtin__" exists in sikuli-script.jar/Lib/sikuli/Screen.py but is commented out. Un-commenting the import statement appears to fix it.

Sikuli Version: Sikuli IDE 1.0.0 Win64
OS: Windows 7 x64
Java: Java 6 x86 JRE
Script Name: template

Code:
Line 4: screen1 = Screen(0)
Line 5: bounds = screen1.getBounds()
Line 6: screenShot = screen1.capture(bounds)

Complete Error Message:
Exception in thread "Thread-8" java.lang.IllegalStateException: No match found
 at java.util.regex.Matcher.group(Unknown Source)
 at org.sikuli.ide.SikuliIDE$ButtonRun.findErrorSourceWalkTrace(Unknown Source)
 at org.sikuli.ide.SikuliIDE$ButtonRun.findErrorSource(Unknown Source)
 at org.sikuli.ide.SikuliIDE$ButtonRun.access$1500(Unknown Source)
 at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(Unknown Source)

[error] script [ template ] stopped with error in line 6
[error] NameError ( global name '__builtin__' is not defined )

Ryan Paterson (ryan-paterson) wrote :

Sorry, Java version is Java 6 x64 JRE, doesn't look like posts can be edited.

RaiMan (raimund-hocke) wrote :

Confirmed, but the solution should be different.

This again shows, that there is a problem with the class names between the Python and the Java level.

Thanks for pointing out.

in your case
screenShot = capture(screen1)

or even
screenShot = capture(SCREEN)

would have worked without problems, since SCREEN is the "constant" object Screen(0), that is used, when you use function undotted.

Changed in sikuli:
status: Fix Released → Confirmed
assignee: nobody → RaiMan (raimund-hocke)
milestone: x1.0-rc3 → 1.1.0
summary: - SCREEN.capture is broken (__builtin__ is not defined)
+ [1.0] SCREEN.capture() is broken (__builtin__ is not defined)
RaiMan (raimund-hocke) on 2014-01-12
Changed in sikuli:
status: Confirmed → In Progress
importance: Undecided → High
RaiMan (raimund-hocke) on 2014-09-08
Changed in sikuli:
status: In Progress → Fix Committed
importance: High → Critical
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers