First I see it does not accept Python..the most popular language by most measures.
Visual Basic is not.
So I made the .py into a .EXE.
It runs, outputs, which is captured and displayed in your "output" window.
So far, so good.
But now the script needs an input, a COM port.
How can I get my reply through your output window into my EXE?
Why not just allow .py?
Solved! Go to Solution.
You can run python scripts directly from Creator. You just need to add the following in the post-build option:
"C:\Python27\python.exe" "C:\<project_dir>.cydsn\python_file.py"
If the python script needs a COM Port input, you will need to import the win32com.client as follows:
import win32com.client
pp = win32com.client.Dispatch("<Pass ProgID here>")
#example usage: pp = win32com.client.Dispatch("PSoCProgrammerCOM.PSoCProgrammerCOM_Object")
In case you have many scripts to run, you can create a batch file with sequence of commands. Just ensure your python script terminates uses sys.exit() to ensure control is passed back. In the post build command, just specify the command as <filename>.bat.
Regards,
Dheeraj
You can run python scripts directly from Creator. You just need to add the following in the post-build option:
"C:\Python27\python.exe" "C:\<project_dir>.cydsn\python_file.py"
If the python script needs a COM Port input, you will need to import the win32com.client as follows:
import win32com.client
pp = win32com.client.Dispatch("<Pass ProgID here>")
#example usage: pp = win32com.client.Dispatch("PSoCProgrammerCOM.PSoCProgrammerCOM_Object")
In case you have many scripts to run, you can create a batch file with sequence of commands. Just ensure your python script terminates uses sys.exit() to ensure control is passed back. In the post build command, just specify the command as <filename>.bat.
Regards,
Dheeraj
I got it working an easier way, but thanks!