0

MG3KWS is the directory for this module and KWS is the module itself that I created for the client file

I created a server and client file and I was about to convert it to exe when I realized that I also need to convert the module it uses to exe. What do I do about the module?

Crystallean
  • 125
  • 7

1 Answers1

2

It looks like Auto PY to EXE uses PyInstaller to do the real work here:

A .py to .exe converter using a simple graphical interface and PyInstaller in Python.

PyInstaller will automatically bundle any dependencies it finds:

What other modules and libraries does your script need in order to run? (These are sometimes called its "dependencies".)

To find out, PyInstaller finds all the import statements in your script. It finds the imported modules and looks in them for import statements, and so on recursively, until it has a complete list of modules your script may use.

So as long as you import your dependencies somewhere reachable from your main script and your virtual environment is active, you should get the right behaviour automatically.

Note that you'll probably need to build two executables: one for your server and a separate one for your client.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • would the dependencies need to be converted to EXE or no like the KWS.py module for example? – Crystallean Feb 06 '22 at 16:58
  • @Crystallean, as long as PyInstaller can find them they'll get included when you build your application. What is `KWS.py`? I thought that was your server code. – ChrisGPT was on strike Feb 06 '22 at 16:59
  • oh the KWS.py is the local python script that I imported within the client script. IT's in the scrnshot Forgot to include the server script in the screenshot lol. – Crystallean Feb 06 '22 at 17:00
  • Yes, I see it in the screenshot (by the way, don't rely on screenshots for critical information; they should only be used to support what is in the question text) but the screenshot doesn't tell me anything about what it contains or how it is used. If you do something like `from MG3KWS import KWS` in `client.py`, when you build an executable from `client.py` PyInstaller will find and include `MG3KWS.KWS`. That's what the second quote in my answer talks about. – ChrisGPT was on strike Feb 06 '22 at 17:03
  • Oh alright thanks! – Crystallean Feb 06 '22 at 17:08
  • terribly sorry! I have a poor habit of not doing that – Crystallean Feb 09 '22 at 22:01