Python Forum
Python script running under windows over nssm.exe - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python script running under windows over nssm.exe (/thread-39960.html)



Python script running under windows over nssm.exe - JaroslavZ - May-12-2023

I have a python script that runs inside this command:

subprocess.run([driver, '/print:printer=' + printer, filename])
If the script is run from the command line, everything works (the script is written as a daemon, ie it never ends and waits for data to arrive from the computer network). But if, for the same script, I create a daemon in windows services using nssm.exe, the script stops working. Respectively, the driver that processes the file cannot load its configuration, which is stored in the same directory where the script is in the python daemon, and the driver is also located there.

Can you advise what I need to modify so that the driver looking for its configuration file can find it when the configuration file is located in the same location as the driver? Do I need to modify the subprocess.run command somehow?

Here is the directory listing (C:\Python37):

PDFXCview.exe driver
PDF-XChange Viewer Settings.dat drivers configuration file
PrinterBirdge.ini configuratin file for daemon
PrinterBridge.py script daemon


PDFXCview.exe does support other parameters on the command line, but none of the parameters were able to force PDFXCview.exe to load the configuration file. However, only if the script runs as a windows service.

Thanks

Jaroslav

[attachment=2363]