Jenkins hangs while running python script that uses PYLINK library.
I am a newb at using python and Jenkins but have managed to script some functional test together for a piece of hardware. However I've run into an issue where when i run a python script in a venv under Jenkins my script fails and hangs Jenkins.
Running Jenkins 2.375.3 Python 3.11.1 pylink-square 1.0.0 using an LPC-Link debugger programmed as Jlink
To replicate the basic behaviour:
import pylink #using pylink-square library
jlink = pylink.JLink()
product_name = 'LPC54608J512'
error = jlink.open()
error = jlink.product_name
print(error)
jlink.oem
error = jlink.opened()
print(error)
error = jlink.connected()
print(error)
error = jlink.target_connected()
print(error)
error = jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
print(error)
error = jlink.connect(product_name, speed='auto')
print(error)
jlink.close()
When run in python terminal > log_good.txt https://drive.google.com/file/d/1EEa7P5ZIG8SpktTGORIZUggyevfGnlD8/view?usp=share_link
when run in Jenkins with same command > log_bad.txt https://drive.google.com/file/d/1EINo9cmh5GVmJROjAbiAsHxtaEDDiYG8/view?usp=share_link
Can anyone tell me what's causing the hang from the trace information? It seems to hang on the connect sequence.
The correct response i would normally see is:
SEGGER J-Link LPC-Link 2 True True False True None
Further update: I have also tried to connect to JLink over IP to rule out a USB issue or permission issue. It still fails to pass the connect sequence. I've also tried using the JLink_x64.dll as a local file with no avail.
Further update: I took a seperate PC, reinstalled jenkins and python. Ran same tests and got same failure. Jenkins is installed on the local system node. I reinstalled as a user on the laptop, and assigned permission to allow the user to run jenkins service. Then ran the test again. The test now passes. Pylink now works successfully -> so can anyone help me to understand why and also is there a work around, when doing the same thing on the first PC which is on a corporate network and running service under corporate account it fails. So is this an issue with PYLINK trying to read or write a file possibly with nor permission or is something else causing it?