10-24-2019 11:19 AM
Hi,
I've recently started to use the Python adaptor within Teststand 2019 which seems to run well for the most part. I do however have an issue when making calls to a dll using the adaptor. This only happens when copying the same python adaptor step from another sequence. It hangs and will only work again if I load the dll call using the python adaptor from scratch.
I have tried unloading the modules in the file menu and reloading the module in the adaptor configuration itself but this makes no difference. Are there any other steps I'm missing?
Thanks.
11-18-2019 06:01 AM
Hi,
I was wondering if anyone has experienced this issue? Here are the steps usually taken
I've tried the refresh option and have also selected the "Unload All Modules" option but this makes no difference.
Is there anything else I can try to save deleting and re-adding the python step to allow the sequence to run successfully?
Thanks.
11-18-2019 11:30 PM
I am unable to reproduce the issue you are getting. Hence, requesting for more information.
In step 5, you mentioned that attempting to execute the sequence file will fail. Do you get any error? If yes, can you share the error message?
Can you also share a sample sequence file and python code module using which I can reproduce the error?
-Shashidhar
11-20-2019 06:20 AM
Hi Shashidhar,
Thanks for your reply. I think this is a bit of a unique one to be honest. The sequence makes a call to a python function using the adaptor. The python function contains calls to a third party dll using a device which was developed in house. This was done using c types. This python function runs reliably when executed as a standalone function outside teststand using command line.
After the function call, the third party device should transmit RF data and this is indicated by a green flashing led on the device. In this case when the sequence is loaded for the first time, this led does not flash correctly and so the sequence fails as no RF transmissions have been received by the other device. When I delete the python step, re-add and point to the python function, it runs fine and continues to do so unless I close that sequence and re-open it.
I'm not sure that providing the contents of the sequence I have created will help with this one but sure let me know what you think.
Thanks.
11-20-2019 07:52 AM
You can try debugging the python code module as mentioned here. You might get more information on what is happening when the tests are failing.
-Shashidhar
11-20-2019 08:09 AM
Hi Shashidhar,
Thanks for that. I'll give that a go and see what it comes up with. I think that code needs a small change. A comma needs to be added before converting the getpid to str.
Thanks.
11-20-2019 08:38 AM
Hi Shashidhar,
So I've tried using the approach you suggested. I now see a different Process ID on different executions of the script. Is there anyway to understand what the Process ID relates to?
Thanks.
11-20-2019
09:36 PM
- last edited on
10-25-2024
02:17 PM
by
Content Cleaner
Python scripts are executed in an external process as mentioned here. Hence, if you need to attach a python debugger, you should not attach it to the TestStand process and always attach it to the external process where the code is being executed. The process id mentions the id of the process where the script is being executed.
Lifetime of the external process which executes the python script is determined by "Python Interpreter to use" option existing in Python adapter settings or Advanced settings existing in the step. Meaning of different options for the setting is mentioned here.
So, if you configure the setting to be "Per Execution", a new Python interpreter session will be used (thereby using new external process) per execution of the client sequence file. Similarly, based on your settings, your script can be executed in an already existing Python interpreter session or might be executed in a different one. This might be one of the reason for getting different process id.
Also, if you use File >> Unload All Modules, all the existing Python Interpreter session will be destroyed and new ones will be created. This might be another reason why you are getting different process id.
-Shashidhar
05-22-2025 03:28 AM
I have the same problem as already described, as soon as I redo my Python class call, the software works again. Load all modules does not change anything, that is very strange. Have you solved the problem?