sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #12728
Re: [Question #206597]: Problem with importing "external" modules
Question #206597 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/206597
Status: Answered => Open
CryoGenID is still having a problem:
Hello RaiMan!
Thanks a lot again for your help :-)
Unfortunately it doesn't work :-(
Here is the "new" code, based on your comment above:
---
import InitSystem
import GlobalSettings
import os
dir = os.path.dirname(getBundlePath())
testsModulePath = os.path.join(dir, "Tests")
modulesToRun = ("Test1", "Test2", "Test_OCR")
print("Testing started: " + InitSystem.getCurrentTime())
popup("Abort test with ALT+SHIFT+C")
if (InitSystem.startUp(GlobalSettings.screenT, GlobalSettings.screenQ, GlobalSettings.screenP)==0): # Init the tests
popup("ERROR during startup, cancelling all tests...")
exit
else: # Startup was OK
# Iterating through all Test-Modules
popup("OK starting Tests in Modules")
if not testsModulePath in sys.path:
sys.path.append(testsModulePath)
for currentModule in modulesToRun:
popup("Working with module " + currentModule + " in directory " + testsModulePath)
# --> Output: "Working with module Test1 in directory \\filecore1\xxx\xxx\xxx\Testing\Tests"
popup("Opening " + currentModule)
# --> Output: "Opening Test1"
exec("import " + currentModule)
# --> Output:
# "File "c:\temp\windows\sikuli-tmp1197008925883503694.py", line 26, in
# exec("import " + currentModule)
# File "", line 1, in
# ImportError: No module named Test1"
# exec(currentModule + ".runModule()")
InitSystem.shutDown() # Shut down the test
print("Testing ended: " + getCurrentTime())
---
I have added the output of the MsgBoxes and the errormessage (after the "faulty" command) in the code
above as a comment.
Regarding the error:
I don't understand it, there is a directory in "Tests" called "Test1.sikuli", in there is "Test1.py", "Test1.html" and "Test1$py.class".
Please tell me that you have another idea ;-)
OS: Win7 x64
Thanks a lot and best regards,
Christian
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.