Custom Server¤
If you want to create a custom 32-bit server, you will need
- a 32-bit version of Python (version 3.8 or later) installed
- PyInstaller installed in the 32-bit Python environment (ideally, you would use a virtual environment to install the necessary packages to create the server)
Some reasons why you may want to create a custom 32-bit server are that you want to
- run the server with a different version of Python,
- build the server for a different architecture,
- install a different version of
comtypes
orpythonnet
(on Windows), - install additional packages on the server (e.g.,
numpy
,my_custom_package
), - embed your own data files in the frozen server.
Using pip from a 32-bit Python interpreter, run
You may also want to install additional packages.
pip install msl-loadlib pyinstaller
You have two options to create a 32-bit server
and you have two options to use your custom server
- Copy your
server32-*
file to the../site-packages/msl/loadlib
directory where you havemsl-loadlib
installed in your 64-bit version of Python to replace the existing server file. - Specify the directory where your
server32-*
file is located as the value of theserver32_dir
keyword argument in Client64.
Using the API¤
Create a script that calls the freeze_server32.main function with the appropriate keyword arguments and run your script using a 32-bit Python interpreter. For example, the following script will include 32-bit numpy
on the server
from msl.loadlib import freeze_server32
freeze_server32.main(imports="numpy")
Using the CLI¤
When msl-loadlib
is installed, a console script is included (named freeze32
) that may be executed from the command line to create a new frozen 32-bit server.
To see the help for freeze32
, run
freeze32 --help
For example, if you want to include your own package and data files, you would run
freeze32 --imports my_package --data .\my_data\lib32.dll