sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #29828
Re: [Question #259687]: UnicodeEncodeError when calling a script in some other script
Question #259687 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/259687
Status: Open => Answered
RaiMan proposed the following answer:
When importing a script from another script, all code on indent level 0 (not indented) is processed once.
This is again done on reload.
Since in your case the function call testnow() is on level 0, it is called on import and hence runs.
Since it seems to produce an error, the irritating message is produced (and is a bug)
If you use your import as usual, but call testnow() in the importing
script, then you should get a better error evaluation.
see comments
Script1: Test
from sikuli import*
import codecs
compareValue = "We built the new Hydra console just for you! We
encourage you take a tour to check out the new look and functionality.
If you’d like to continue using the old Hydra, click “Switch Back.”"
def testnow():
getTitle = Region(find("1419429990021.png"))
getTitle.highlight(2)
getContent = Region(getTitle.x, getTitle.y+50, getTitle.w, getTitle.h)
hover(getContent)
for x in xrange(3):
mouseDown(Button.LEFT)
mouseUp()
type("c", KEY_CTRL)
gettext = Env.getClipboard().encode('utf-8')
print "Text: ",gettext
if gettext == compareValue:
print "Pass"
else:
print "Fail"
# testnow() # should not be called here
Script2: Test1
from sikuli import * # not needed in main script
import codecs # not needed since not used here
import test
reload(test)
test.testnow()
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.