Windows exe behaving differently than Python script

I’ve got a script that communicates with a local server and that works fine as a script. However, when I build a wheel file and then install it, with the corresponding exe on Windows, that exe ends up crashing because a variable isn’t defined. At first I thought this might be due to differences in versions of dependencies, but I got them sync’d up so they’re the same and the problem persists.

Previous versions of the script and exe have worked fine.

Any suggestions on what the issue might be?

How would be possibly be able to guess from what you said?

You have to share details if you want us to give useful feedback.

Please try to narrow down the issue and create an example we can work with. Some hints:

Aside from that, I can’t understand what you mean by “the corresponding exe”. Are you using something like [project.scripts] in pyproject.toml, or creating entry_points with Setuptools? Or does your wheel actually contain a separate compiled executable created by the build process somehow? Or just what?

A proper example will include showing how you try using the script that “works fine” locally, as well as the exe that “ends up crashing”.