Hmm, gross.
I can see exactly where in PyInstaller’s code this error is being raised. Here it tries to locate this Py_DontWriteBytecodeFlag configuration variable, and following through to the definition of the DECLVAR() macro here you can see the error being raised. I notice the docs for the flag disappears if you rewind back to Python 3.6 but that flag must still be there or everyone would be experiencing issues with Python 3.6. And I can confirm that it’s still present in my python36.dll using:
import ctypes
print(ctypes.POINTER(ctypes.c_int).from_address(ctypes.addressof(ctypes.pythonapi.Py_DontWriteBytecodeFlag)).contents)
which would raise an AttributeError if it didn’t exist (otherwise prints 1 if running Python with the -B option).
What I really don’t understand is why only this one user is seeing it. The only thing I can think of is said user has another incompatible copy of python36.dll in PATH which is being read instead. Could you ask them to run where python* in the command prompt and tell you if there’s anything else there? Could you also build a simple print("hello") app in --onedir mode using your environment and upload it somewhere I can inspect it?
Brénainn
Hmm, I wouldn’t be surprised if this is just a convoluted permission error. I’ve checked the python36.dll inside the application you sent and the flag is definitely there so whatever the problem is, it’s not what it says it is. Looking back at the source code I notice that that flag is the first attribute/function to be loaded from said DLL so it’s quite likely that Py_DontWriteBytecodeFlag is a red-herring and the real problem is it’s not able to load the DLL at all. I do see a fail-safe for failing to load the DLL although I can’t verify if it works…