SharpCap Version 4.1.12395
If I type the following text into a file with a text editor and feed it to SharpCap, MDLTargetingAssistant.SavePostAdjusted_PlateSolveCoodinates() will be called as one would expect:
SEQUENCE
RUN PYTHON CODE "MDLTargetingAssistant.SavePostAdjusted_PlateSolveCoodinates( )"
END SEQUENCE
This will work the equally well:
SEQUENCE
RUN PYTHON CODE "result = MDLTargetingAssistant.SavePostAdjusted_PlateSolveCoodinates()"
END SEQUENCE'
And so will this:
SEQUENCE
RUN PYTHON CODE MDLTargetingAssistant.SavePostAdjusted_PlateSolveCoodinates()
END SEQUENCE'
BUT, this won't work:
SEQUENCE
RUN PYTHON CODE "MDLTargetingAssistant.SavePostAdjusted_PlateSolveCoodinates()"
END SEQUENCE
The sequencer does not execute the python code, with no error reported, as if the line was a no-op.
The difference, is that if a line of python code has no spaces in it, but is enclosed by double quotes, it is ignored. Just adding a space within the Python text will work, or removing the enclosing quotes will make it work. But you can only omit the quotes if the Python code contains no spaces.
I frequently edit my sequences in a text editor, so forgetting to put a space between the parentheses in a Python function call is easy. I try to remember to do it after I discovered the problem a few weeks ago, but sometimes forget. Just got bit by this one again tonight, so thought I should report it. Seems the Sequencer parser should be happy to have quotes whether there is a space or not, and certainly not just silently skip running your python code!
I believe there is a similar parsing issue involving calling subroutines that have spaces in their names. The sequencer only wants to see a subroutine name enclosed in quotes if the name contains at least one space. I think I saw this with GOSUB and/or DEF SUB but not with ON ERROR.
Sequencer RUN PYTHON CODE - to quote or not to quote, etc, etc
Forum rules
If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs
Please also read about Troubleshooting USB Issues before posting.
*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***
Please include the following details in any bug report:
* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
If you have a problem or question, please check the FAQ to see if it already has an answer : https://www.sharpcap.co.uk/sharpcap-faqs
Please also read about Troubleshooting USB Issues before posting.
*** Please do not post license keys - please report any problems with licensing to 'admin' by private message ***
Please include the following details in any bug report:
* Version of SharpCap
* Camera and other hardware being user
* Operating system version
* Contents of the SharpCap log after the problem has occurred.
[If SharpCap crashes, please send the bug report when prompted instead of including the log]
-
lowenthalm
- Posts: 224
- Joined: Mon May 07, 2018 12:27 am
- admin
- Site Admin
- Posts: 17534
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Sequencer RUN PYTHON CODE - to quote or not to quote, etc, etc
Hi,
thanks for posting - looks like the code is not stripping the double quote from beginning/end of the parameter when there are no spaces in it. I can see the code that actually checks for the space before trimming the quotes off, so I obviously thought it was important at the time, but can't quite recall why. Let's see if changing it breaks anything!
cheers,
Robin
thanks for posting - looks like the code is not stripping the double quote from beginning/end of the parameter when there are no spaces in it. I can see the code that actually checks for the space before trimming the quotes off, so I obviously thought it was important at the time, but can't quite recall why. Let's see if changing it breaks anything!
cheers,
Robin