Python Windows Service - traceback.print_exception() failed

0

I've been playing around with trying to setup Python scripts (Both .PY and .EXE via Pyinstaller) as Windows Services. My challenge has been that most problems encountered don't seem to relate to my own.

I managed to successfully setup a Virtual Environment once, and get an example service running. However, in documenting my steps, and attempting to recreate the Virtual Environment and running the service I encounter issues.

> python -m venv venv
> venv\scripts\activate.bat
> pip install pypiwin32

Then as instructed in this StackOverflow Question. I followed lindsay.stevens.au's answer with running:

> python myvenv\Scripts\pywin32_postinstall.py -install

Then copying venv\Lib\site-packages\win32\pythonservice.exe to venv\Scripts\pythonservice.exe

I've been using this Service Example from HaroldMils on GitHub as app.py.

When I run this:

> python app.py install
Installing service PythonExample
Service installed

> python app.py debug
Debugging service PythonExample - press Ctrl+C to stop.
Error 0xC0000005 - Python could find the service class in the module

<Error getting traceback - traceback.print_exception() failed

(null): (null)

My previous virtual environment still works, with the exact same script. I've tried removing the virtual environment and trying again, same result. What am I doing wrong? I can't get any more debug info out of this.

On the Virtual Environment that works, I tried uninstalling pypiwin32, reinstalling, it still works.

EDIT: Using Python 3.7.1 32-Bit

python
windows
service
pywin32
asked on Stack Overflow Feb 26, 2020 by sdavis891 • edited Feb 26, 2020 by sdavis891

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0