I wanted to get the serial module in python to work being called from a Sequencer script. I realize that I will need to disconnect the focuser in order to be able to access it thru the python script but that is not a problem as I will only be doing it one or two times a night.
I have been programming since the days of MS DOS and was a prolific bat file programmer and wondered if I started the python script from a batch file if it would run under the admin account.
What I did was use the Sequencer "Run this python script" to start a python script that starts a DOS bat file with only two calls:
import os
os.system("c:\\Users\\user\\Documents\\SerialComm.bat")
The bat file just runs my python script with the call to serial and other code to access the focuser but it uses the system path for python and can see all the python modules and therefore runs properly.
py c:\Users\user\Documents\GetStatus.py
The only drawback is having to disconnect/reconnect the focuser but since that only occurs a few times it should not be a problem.
I got the Serial module to work
- admin
- Site Admin
- Posts: 17610
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: I got the Serial module to work
Hi,
good to hear that you found a solution to the problem - it looks like you are now running the code that you need in an external version of Python, rather than SharpCap's internal version, which gets you around the lack of the serial module.
Just one thing to note - there is actually a sequencer step that you can use to run your batch file directly without needing to go via python in SharpCap - look for the 'run <program to run> with <parameters>' in the misc section of the sequencer blocks.
cheers,
Robin
good to hear that you found a solution to the problem - it looks like you are now running the code that you need in an external version of Python, rather than SharpCap's internal version, which gets you around the lack of the serial module.
Just one thing to note - there is actually a sequencer step that you can use to run your batch file directly without needing to go via python in SharpCap - look for the 'run <program to run> with <parameters>' in the misc section of the sequencer blocks.
cheers,
Robin