1

I am trying to build a single-file Windows command shell executable with Pyinstaller. This is a simple test file, which is enough to produce the problem.

import code    
code.InteractiveConsole().interact()

I can generate a single executable file with the following Python script

import os
import PyInstaller.__main__
PyInstaller.__main__.run([
    '--name={!s}'.format('test'),
    '--clean',
    # '--upx-dir={!s}'.format( os.path.join(r'c:/usr', r'upx-3.96-win64') ),
    '--onefile',
    'test.py'
])

This works. However, if I uncomment the --upx-dir line the executable fails with this error message

Error loading Python DLL 'C:\Users\ATWORK~1\AppData\Local\Temp\_MEI55442\python38.dll'.
LoadLibrary: The parameter is incorrect.

I expect that my instructions to Pyinstaller are inadequate because I would expect the python DLL to be bundled (that was my intention in building a single executable). However, I don't know what I need to do. I have tried including the additional commands

    '--win-private-assemblies',
    '--win-no-prefer-redirects',

but that didn't change anything.

I am working on a Windows 10 machine with Python 3.8 installed and the latest version (3.96) of UPX.

Blair
  • 135
  • 1
  • 9

0 Answers0