← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #146640]: import some-script.sikuli: needs from sikuli import * in some-script.sikuli

 

Question #146640 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/146640

Description changed to:
**** with X-1.0rc3

it should be

from sikuli import *

----------------------------------------------------------

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

Hi RaiMan,
I kept from sikuli.Sikuli import * in the first line. Still the error message(NameError: global name 'click' is not defined ) is displaying.
Thanks
Rajesh

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.