2
« on: March 16, 2012, 04:23:50 PM »
Hi, I am trying to run a Python script from voxcommando
This is the command that I am trying to run:
c:\python32\python.exe s:\prog\VC_RunPython.py alpha red
This command works OK from the DOS prompt, but when I set it up from VC I dont think it passes the parameters correctly to Python
- or I don't understand how to do it !!
These are the parts of the command line:
c:\python32\python.exe << this is the python executable
s:\prog\VC_RunPython.py << this is the name of the python script
alpha << this is runtime parameter 1 (using payload list 1)
red << this is runtime parameter 2 (using payload list 2)
This is the Python script: all it does is write out to a file the values of the parameters it received
----------------------------------------------------------------------------------
#s:\prog\VC_RunPython.py
import sys
import datetime
now = str(datetime.datetime.now())
myfile = open(r's:\prog\test.txt','a')
myfile.write('\nStarting ... '+now+'\n')
print ('ProgramName is: ' + sys.argv[0])
for i in range(len(sys.argv)):
writeString = 'Parameter ['+str(i)+']: ' +sys.argv +'\n'
print(writeString)
myfile.write(writeString)
myfile.close()
------------------------------------------------------------------------------------------------
When I test in VC it does the OSD fine, but it just flashes a black DOS box for the python call
I have attached the screenshots -
Any help would be much appreciated! I think the ability to call Python would be a great facility for VC as I an using Python for Home Automation.
Thanks!! SaScot007