Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading Python DLL when there're Unicode chars in absolute path #1295

Closed
CarlLee opened this issue Jun 13, 2015 · 5 comments
Closed

Error loading Python DLL when there're Unicode chars in absolute path #1295

CarlLee opened this issue Jun 13, 2015 · 5 comments

Comments

@CarlLee
Copy link

CarlLee commented Jun 13, 2015

Program crashes and unable to load Python DLL when there're Unicode characters in absolute path.
The error is gone when after renaming all folder names containing Unicode characters to ASCII names.
Below is the error message.

D:\Projects\python\EMSStatistics\dist\中文路径>EMSStatistics.exe
Error loading Python DLL: D:\Projects\python\EMSSTA~1\dist\涓枃璺緞\python27
.dll (error code 126)
@codewarrior0
Copy link
Contributor

That's when running in onedir mode (the default), right? Does the same thing happen if you run pyinstaller with --onefile?

@CarlLee
Copy link
Author

CarlLee commented Jun 13, 2015

Error occurred, too, but a different one. Here's the trace:

D:\Temp\pyinstaller_test\中文>hello
Traceback (most recent call last):
  File "<string>", line 21, in <module>
  File "D:\Programs\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.
py", line 507, in install
    sys.meta_path.append(FrozenImporter())
  File "D:\Programs\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.
py", line 156, in __init__
    raise ImportError("Can't load frozen modules.")
ImportError: Can't load frozen modules.

@codewarrior0
Copy link
Contributor

There are a handful of issues about this with a few variations. The gist of it is that the part of PyInstaller written in C isn't fully unicode-aware. It's supposed to use MS-DOS filenames as a kind of workaround, but it looks like it isn't even doing that correctly - your first error has a mix of MS-DOS filenames and unicode characters.

@CarlLee
Copy link
Author

CarlLee commented Jun 14, 2015

So it seems there should be some refactoring of C code.

@codewarrior0
Copy link
Contributor

This is fixed in python3 branch. The Python DLL is now loaded using the wide-string Windows API, so any unicode path is allowed.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants