After writing a debugging / dev SMTP server as a Windows Service in Python using pywin32, I decided to figure out how to wrap the Python Windows Service into an EXE so you wouldn’t have to install Python to get it running.
I had first attempted to do this in PyInstaller but upon starting the service, Windows would report failure, but the server would still be working. I gave up on PyInstaller and found a solution in py2exe.
This was my py2exe
Where “DummySMTP” refers to the
DummySMTP.py file in the current working directory.
To compile the EXE, run:
This will create two folders in the current working directory called
build. In the
dist directory will be your EXE and other necessary files.
To install this as a service, in an administrative command prompt, run:
Please note that when the service runs, it will access that directory. So relocate the directory accordingly.