← Back to team overview

sikuli-driver team mailing list archive

[Question #246693]: Unable to run .exe file with environment variable

 

New question #246693 on Sikuli:
https://answers.launchpad.net/sikuli/+question/246693

Hi RaiMan,

I wrote a new version of my previous bug. This time I don't use the os.environ but subprocess.call. 

Thanks! I very much appreciate your helpfulness in this forum.

I don't want to hard code the path to the .exe file I want to test in my .sikuli file. Our scheduler will run the .exe file through the settings of environment variables, without hard coding.
And we don't want to change the path setting, but only run through an environment variable. 
I wrote the following  script, it works on python but not on sikuli. Would you have any alternatives\workarounds?

#MyApp environment variable is created in system in variables under System\Advanced Settings
# My file path is: C:\2014-03-07(20h30)\bin\MyApp.exe
#We can run the following script on Python, it's OK
#We can also run "%MyApp%" on command prompt, it's OK. 

from sikuli import*
import os, sys
import subprocess

os.system('echo %MyApp%')  #We have the path to environment variable. [GOOD]
subprocess.call('"%MyApp%"', shell = True) #But we can't run it [BAD]

We have the following error message (not pasted the whole message):

'C:\2014-03-07' is not recognized as an internal or external command,
operable program or batch file.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.text.FlowView$FlowStrategy.layoutRow(Unknown Source)
at javax.swing.text.FlowView$FlowStrategy.layout(Unknown Source)
at javax.swing.text.FlowView.layout(Unknown Source)
at javax.swing.text.BoxView.setSize(Unknown Source)
at javax.swing.text.BoxView.updateChildSizes(Unknown Source)
at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
at javax.swing.text.BoxView.layout(Unknown Source)
at javax.swing.text.BoxView.setSize(Unknown Source)
at javax.swing.text.BoxView.updateChildSizes(Unknown Source)
at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
at javax.swing.text.BoxView.layout(Unknown Source)
at javax.swing.text.BoxView.setSize(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI.modelToView(Unknown Source)
at

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