sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #01495
[Question #146640]: NameError: global name is not defined
New question #146640 on Sikuli:
https://answers.launchpad.net/sikuli/+question/146640
Hi Raimund
I am not sure if I am doing anything incorrect here. ( followed the info provided in Question #144742 and reuse code and images document )
#File # 1 . myLib
def check():
print "Inside check"
click( img)
print "finished checking"
# File # 2 testmyLib
myScriptPath = "C:\\scripts"
if not myScriptPath in sys.path: sys.path.append(myScriptPath)
print myScriptPath
from myLib import *
check() # makes the call
Log file :
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
C:\scripts
Inside check
[error] Stopped
[error] An error occurs at line 11 [error]
Error message: Traceback (most recent call last):
File "C:\DOCUME~1\LOCALS~1\Temp\sikuli-tmp7364835550079994134.py", line 11, in check() # makes the call
File "C:\scripts\myLib.sikuli\myLib.py", line 3, in check
click("1298502599449.png")
NameError: global name 'click' is not defined
I did try using the get getBundlePath() api as show below
import os
myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)
import myLib
myLib.check()
Still the same issue. It is able to call the check() function but not able to execute the click(img) command.
How do I define the global name ?
Appreciate your time and help
Thanks
SA
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.