pass in newimagepath on the command line

Asked by Marc Summers on 2018-04-27

runsikulix.cmd -r 796_795_garmin_charts_ctrl_eu_ifr_tdd_nd.sikuli -f "C:\Users\marc.summers\Desktop.sikuli\logs\796_795_garmin_charts_ctrl_eu_ifr_tdd_nd.sikuli.log" -d 2 --args "os.path.join(os.environ.get('USERPROFILE'),'Desktop.sikuli\pictures_1980_1200')"

This is my command line. I am trying to pass in the newimagepath on the command line
but it is not working. This is the error I get:

[error] ImagePath: add: not valid: os.path.join(os.environ.get('USERPROFILE'),'Desktop.sikuli\pictures_1980_1200') ^M
[error] RunTimeIDE: Wait: Abort: Jython traceback - current first:
Sikuli (69)
796_795_garmin_charts_ctrl_eu_ifr_tdd_nd (22)^M
[error] RunTimeIDE: ImageMissing: BGR.png^M
[error] script [ C:\Users\marc.summers\Desktop.sikuli\796_795_garmin_charts_ctrl_eu_ifr_tdd_nd.sikuli ] stopped with error at line --unknown--^M
[error] Error caused by: Traceback (most recent call last):
  File "C:\Users\marc.summers\Desktop.sikuli\796_795_garmin_charts_ctrl_eu_ifr_tdd_nd.sikuli\796_795_garmin_charts_ctrl_eu_ifr_tdd_nd.py", line 22, in <module>
  File "C:\Users\marc.summers\AppData\Roaming\Sikulix\Lib\sikuli\Sikuli.py", line 69, in wait
        at java.lang.Thread.stop(Unknown Source)^M
        at org.sikuli.script.RunTime.abortScripting(RunTime.java:71)^M
        at org.sikuli.script.Region.wait(Region.java:2751)^M
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)^M
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)^M
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)^M
        at java.lang.reflect.Method.invoke(Unknown Source)^M
java.lang.ThreadDeath: java.lang.ThreadDeath

SIKULI VERSION 1.1.2-201803080837

JAVA VERSION
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

WINDOWS VERSION

OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.15063 N/A Build 15063

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Marc Summers
Solved:
2018-04-27
Last query:
2018-04-27
Last reply:
Marc Summers (2aircraft) said : #1

Command line in windows Batch file:
runsikulix.cmd -r %1 -f "%USERPROFILE%\Desktop.sikuli\logs\%1.log" -d 2 --args 'os.environ.get('USERPROFILE')' 'Desktop.sikuli' 'pictures_1920_1200'

What shows up on execution output:

runsikulix.cmd -r 796_795_garmin_charts_ctrl_eu_ifr_tdd_nd.sikuli -f "C:\Users\marc.summers\Desktop.sikuli\logs\796_795_garmin_charts_ctrl_eu_ifr_tdd_nd.sikuli.log" -d 2 --args 'os.environ.get('USERPROFILE')' 'Desktop.sikuli' 'pictures_1920_1200'

Error I get now:

[error] ImagePath: add: not valid: 'os.environ.get('USERPROFILE')'\'Desktop.sikuli'\'pictures_1920_1200'

Marc Summers (2aircraft) said : #2

OK, I solved it myself, here is what I did.

In the invoking Batch Script, I did this:

runsikulix.cmd -r %1 -f "%USERPROFILE%\Desktop.sikuli\logs\%1.log" -d 2 --args pictures_1920_1200

In the sikuli script I did this:

newimagepath = os.path.join(os.environ.get('USERPROFILE'),'Desktop.sikuli')
newimagepath = os.path.join(newimagepath,sys.argv[1])
addImagePath(newimagepath)