NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Python steps do not start correctly and blue screen

Hi,

 

I'm using TestStand 2016 with the python step module and pthon 3.8.2.

 

Randomly I get the problem that TestStand starts my python scripts, but does not execute them at all. The even do not close anymore.

I get the same behaviour sometimes, if I try to start the scripts with the cmd step. There in the console I can see that the python interpreter get started, but does not execute anything. After this appeared once, I'm unable to run any new python script with TestStand.

The only way to resolve it, is to retsart the PC, which even leads to a bluescreen during reboot.

 

When I test my scripts within the IDE, with which I wrote them, they work proberly.

There is also no error, if a start them manually with the windows cmd.

 

Has anybody encountered this problem or has an idea how to solve it?

 

Max

0 Kudos
Message 1 of 5
(2,726 Views)

Edit:

I checkedtoday what is happening in the background and I saw, there are several instances of the niPythonHost.exe spwaned. One for each of my threads.

But with the taskmanager I can only kill one of the tasks, which frees my complete test execution again.

If I then try to close the remaining niPythonHost.exe after the test has finished it states:

Access denied.

Unload all modules or closing TestStand also do not close niPythonHost.exe .

0 Kudos
Message 2 of 5
(2,685 Views)

max_str,

You mentioned that issue occurs irrespective of using Python custom step types or when you use command step to invoke the python interpreter and run the script. Also, it does not occur when you execute it using IDE.

 

Running it through command step (where issue exists) is similar to directly executing the python script using python.exe. This makes me think that, issue might be in the script and might be related to current working directory or similar things.

 

The following are the things I recommend to debug more:

  • Have "Interpreter Session to use" option in the Python custom step type to use 'Global', thereby using only one interpreter session per instance of TestStand. Each interpreter session creates an external process 'niPythonHost.exe' where scripts are executed. Having only one session makes debugging easy.
  • Attach the debugger in your IDE to determine if there is any deadlock like scenario due to which execution does not continue. Determining the process to which the debugger should be attached is present in the help document of Python custom step types.

 

-Shashidhar

0 Kudos
Message 3 of 5
(2,668 Views)

I have changed to Global, but now I have the Problem, that my scripts do not start in parallel anymore (spawned by TestStand threads in parallel).

I'm quit new to the TestStand python environment. Is it possible to run several scripts in parallel with the global setting? I even need to run the same script twice.....

I checked my code but could not find any possible deadlock. I attached the script, which I need to run twice in the background.

It just builds an ethernetframe and sends it in loop with scapy untill a close file is found.

0 Kudos
Message 4 of 5
(2,660 Views)

Ok I think I found what the caused the error but not why....

I needed to set a wait time from currently 1s between the start of each of my parallel python calls. This seems to be stable now.

Same behaviour if i would start the script fast parallel with cmd.

0 Kudos
Message 5 of 5
(2,652 Views)