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

Rubynator posted a new comment:
@RaiMan It's related to this topic,
I can't get this example working.  It throws multiple errors, Can you double 
check the code?

In this example of:

# get Sikuli’s Filemanager class
import org.sikuli.basics.FileManager as SFm
import os
# get the folderpath the main script is stored
scriptPath = os.path.join(os.path.dirname(os.path.dirname(getBundlePath())))
# get the folder path of a ….skl stored in the same folder (here sub.skl)
sub = os.path.join(scriptPath, "sub.skl“)
# unzip to temp folder (the only option here ;-)
subPath = SFm.unzipSKL(sub)
# put it on sys.path
sys.path.append(os.path.dirname(subPath))
# import it
import sub
# use it
….
# before exit delete it
SFm.deleteFileOrFolder(subPath)

So I'm wondering:

1. What is "import sub".  Since there's no library called sub,  I keep getting 
this error:
[error] script [ Assignment1 ] stopped with error in line 12
[error] ImportError ( No module named sub )

2. I commented out the import sub , and then this time this line gives an 
error: 
"scriptPath = os.path.join(os.path.dirname(os.path.dirname(getBundlePath())))"
Can you check to see if the usage is correct?

Here's the error message I get from this line: 
C:/Users/Rubynator/Desktop/SikuLiSource\assignment1.skl: No such file
[error] script [ Playdom2 ] stopped with error in line 11
[error] TypeError ( 'NoneType' object is unsubscriptable )


So  with the import sub commented out I used this instead: 
scriptPath = os.path.dirname(os.path.dirname(os.path.dirname(getBundlePath())))

With this slight modification the script works on my local fine, then I 
exported it into a .skl file. Send it to another Win64Bit machine with a fresh 
install of Sikuli (1.0.1) and java on.
Ran it with: runide -r C:\Users\Rubynator\Desktop\assignment1.skl -d 3 -c
Again this is with no import sub, and a slight modification to the scriptPath= 
line.
It fails with a long log file, below is the output:

C:\Sikuli>runide -r c:\users\Rubynator\desktop\assignment1.skl -d 3 -c
'Files' is not recognized as an internal or external command,
operable program or batch file.
+++ running this Java
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
+++ trying to start Sikuli IDE
+++ using: -Xms64M -Xmx512M -Dfile.encoding=UTF-8 -Dsikuli.FromCommandLine -jar
C:\Sikuli\sikuli-ide.jar -r c:\users\Rubynator\desktop\assignment1.skl -d 3 -c
[debug] SikuliIDE: Switching to SikuliScript with option -r, -t or -i
[debug] SikuliScript: CmdOrg: -r c:\users\Rubynator\desktop\assignment1.skl -d 
3 -
c
[debug] Running on Java 7 (1.7.0_51-b13)
[debug] --- Sikuli parameters ---
[debug] 1: -r
[debug] 2: c:\users\Rubynator\desktop\assignment1.skl
[debug] 3: -d
[debug] 4: 3
[debug] 5: -c
[debug] FileManager: tempdir create: 
C:\Users\Rubynator\AppData\Local\Temp\Rubynator
\tmp-1400964603.sikuli
[debug] SikuliScript: givenScriptName: 
C:\Users\Rubynator\AppData\Local\Temp\Rubynator\tmp-1400964603.sikuli\assignment1.sikuli
[debug] SikuliX Jython Support Build: 1.0.1 12SEP2013160248
[debug] Trying to run script: 
C:\Users\Rubynator\AppData\Local\Temp\Rubynator\tmp-14
00964603.sikuli\assignment1.sikuli\assignment1.py
[debug] JythonScriptRunner: : executeScriptHeader: adding SikuliX Lib path to sy
s.path
C:\Sikuli\sikuli-ide.jar\Lib
[debug] Jython: sikuli: __init__: entering
[debug] Jython: sikuli: Sikuli: entering
[debug] Jython: sikuli: Sikuli: constants
[debug] Jython: sikuli: Sikuli: import Region
[debug] Jython: sikuli: Sikuli: import Screen
[debug] Jython: sikuli: Sikuli: Env.addHotkey
[debug] Jython: sikuli: Sikuli: import Match
[debug] Jython: sikuli: Sikuli: import Pattern
[debug] Jython: sikuli: Sikuli: import Location
[debug] Jython: sikuli: Sikuli: import ScreenUnion
[debug] Jython: sikuli: Sikuli: import Finder
[debug] ResourceLoaderBasic: SikuliX Package Build: 1.0.1 12SEP2013160242
[debug] ResourceLoaderBasic: check: we are running on arch: x86
[debug] ResourceLoaderBasic: check: using Java at: C:/Program Files (x86)/Java/j
re7/
[debug] ResourceLoaderBasic: check: Exists Environment.SIKULIX_HOME? YES: C:/Sik
uli/libs
[debug] ResourceLoaderBasic: checkLibsDir: C:/Sikuli/libs
[debug] ResourceLoaderBasic: loadLib: WinUtil
[debug] ResourceLoaderBasic: loadLib: Found: WinUtil
[debug] ResourceLoaderBasic: loadLib: Now loaded: WinUtil
[debug] ResourceLoaderBasic: checkLibsDir: Using libs at: C:\Sikuli\libs
[debug] ResourceLoaderBasic: check: Using this as OCR directory (tessdata) too
[debug] ResourceLoaderBasic: loadLib: VisionProxy
[debug] ResourceLoaderBasic: loadLib: Found: VisionProxy
[debug] ResourceLoaderBasic: loadLib: Now loaded: VisionProxy
[debug] Jython: sikuli: Sikuli: import App
[debug] ResourceLoaderBasic: loadLib: Is already loaded: WinUtil
[debug] Screen: initScreens: basic initialization (1 Screen(s) found)
[debug] *** monitor configuration (primary: 0) ***
[debug] Screen 0: S(0)[0,0 1440x900]
[debug] *** end monitor configuration ***
[debug] Jython: sikuli: Sikuli: import Key
[debug] Jython: sikuli: Sikuli: import from Basics
[debug] Jython: sikuli: Sikuli: import from compare
[debug] Jython: sikuli: Sikuli: init SikuliImporter
[debug] Jython: sikuli: Sikuli: import SikuliScript
[debug] Jython: init SCREEN as ()
[debug] Sikuli-IDE environment setup: 7438
C:/Users/Rubynator/AppData/Local/Temp/Rubynator\assignment1.skl: No such file
[error] script stopped with error in line 10
[error] TypeError ( 'NoneType' object is unsubscriptable )
Exception in thread "main" java.lang.IllegalStateException: No match found
        at java.util.regex.Matcher.group(Unknown Source)
        at org.sikuli.scriptrunner.JythonScriptRunner.findErrorSourceWalkTrace(J
ythonScriptRunner.java:326)
        at org.sikuli.scriptrunner.JythonScriptRunner.findErrorSource(JythonScri
ptRunner.java:290)
        at org.sikuli.scriptrunner.JythonScriptRunner.runPython(JythonScriptRunn
er.java:200)
        at org.sikuli.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunn
er.java:162)
        at org.sikuli.basics.SikuliScript.main(SikuliScript.java:181)
        at org.sikuli.ide.SikuliIDE.main(SikuliIDE.java:212)

C:\Sikuli>

Any thoughts will be highly appreciated! 
Thank you!

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to