blog Attempting a Windows Service

Tags:
mqtt python windows

On my Mac, I wrote a small nagger app to help remind me when I may have extended a break too long. It is connected via mqtt to a hardware bell I have on my desk.

Recently I have been spending a bit too much time in Factorio so wanted to see if I could make a similar version on Windows.

I have not previously used my Windows PC for development (I do all of my work on MacOS or Linux), so the first step was to install VSCode, uv , and git. This was not particularly difficult and recently it seems like installers automatically handled updating PATH for powershell.

I quickly got a script working using MQTT for some things, and it worked fine when being directly called. The next step is to get it running as a Windows service. While I found some guides and stack overflow posts, this is where I am currently paused.

Error starting service: The service did not respond to the start or control request in a timely fashion.

If I was on MacOS or Linux (Systemd) I know more about how to debug a running process, but I’m fairly new to this on Windows. Using Event Viewer and other tools, I try to look up the reasons but it is somewhat difficult to use and does not seem to provide detailed information.

It’s possible that I will need to try something like PyInstaller to package it up differently.

For now I am just using task scheduler to run the task at login, but ideally I would get it working as a proper service at somepoint.

This small excercise has not exactly endeared me to Windows development, but it is also a reminder of how used we get to our native development platforms and how foreign a different platform can feel, even if the underlying programming language is the same.