NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Python session crashing

Solved!
Go to solution

Hello!

 

So, I'm currently working on a TestStand refactor and I'm facing the following problem:

  • We're changing all cmd actions, that used to call python scripts, to actual python actions
  • But, at some point of our execution, the Python session seems to crash and none of our python actions seems to run
  • This behavior is very inconsistence. Some of us got the python session issue and some of us don't (also depends on the execution)

Looking for solutions, we found out that "per thread" python option in adapters might solve the issue, but it doesn't. 

 

Does anyone recognize this inconsistence or know a way to solve this issue?

 

PS: We're using a venv (which is active and correctly set in adapters as well)

 

Thanks! 

0 Kudos
Message 1 of 7
(879 Views)

Could you please specify, which TestStand and Python versions you are using?

0 Kudos
Message 2 of 7
(815 Views)

Hi Oli

 

We're using TS 2019 32-bit and Python 3.7.9.

 

New updates:

  • We found out that python session was crashing because some scripts were failing. But, we're looking for an option that "creates" a python session for each python action, so they don't mess with each other
  • Also, isn't all exception that could raise a python session crash. There's some specific errors in scripts that reproduce the issue

Now, we're trying to identify which errors might crash the session and fixing all failing scripts. We're also looking for an option that "creates" a python session for each action and how to reproduce this option for all py actions (since we've a lot of them and manually changing isn't cool)

 

Thanks! 

0 Kudos
Message 3 of 7
(791 Views)

Hello Oli, do you have any tips regarding my last update?

 

Thanks!

0 Kudos
Message 4 of 7
(730 Views)

Sorry.... I did some research, but forgot to answer.

 

My original suspicion was about a TestStand Bug, I thought I'd remember. I went through the release notes, but I couldn't find anything.

 

I am not working with Python myself, so my possibilities are limited

 

0 Kudos
Message 5 of 7
(721 Views)

Thats okay.

 

Thanks for the feedback Oli

0 Kudos
Message 6 of 7
(709 Views)
Solution
Accepted by topic author mlop100@motorola.com

We found out that python session was crashing because some scripts were failing. But, we're looking for an option that "creates" a python session for each python action, so they don't mess with each other

=> In every Python step, there is advanced settings. Using that, you can configure the interpreter session to use for executing the step. You have lot of flexibility where you can configure to use a new session for every step execution OR a session for executing few selected Python steps.

 

Note: If you have lot of sequence files and Python steps, you can use TestStand APIs to programmatically set the option.

 

Also, isn't all exception that could raise a python session crash. There's some specific errors in scripts that reproduce the issue

=> Python adapter does catch exceptions thrown from the user module and use it in the error message of the executing step. Can you provide a sample example where throwing exception is crashing the Python session? If it is a TestStand bug, we will aim to fix it in a future release.

 

We're using a venv (which is active and correctly set in adapters as well)

=> TestStand, as of today, does not support venv virtual environments. We support only virtualenv environments. Please ensure to use virtualenv and not venv.

 

-Shashidhar

Message 7 of 7
(698 Views)