-
Notifications
You must be signed in to change notification settings - Fork 252
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
Problem in _setup() on non-English OS #346
Comments
Thanks for reporting this @pochamarui! I wonder, can it be as easy as putting this line at the top of the # -*- coding: utf-8 -*- |
I don't have access to that machine at the moment, so I cannot currently test, but I think it will not work. By the look of it, that string above is used so that unicode strings - written inside the python source file - can be handled correctly. In my case, the string is not in the source file, but returned by the OS. |
Cool, no worries. Are you able to post the message here? I need some way of reproducing the error, ideally during the automated tests. |
I asked a colleague with a French machine to do a few tests.
Side-notes:
|
Hey, ran into this today. I'm proposing the following: def _setup(module, extras):
"""Install common submodules"""
Qt.__binding__ = module.__name__
def _warn_import_error(exc):
if sys.version_info < (3, 0):
if isinstance(exc, unicode):
exc = exc.encode('ascii', 'replace')
msg = str(exc)
if "No module named" in msg:
return
_warn("ImportError: %s" % msg)
[...] I can only see the issue in Python 2, therefore the version check. import sys
text = str(u"DLL load failed : le module spécifié est introuvable.".encode('ascii', 'replace'))
>> b'DLL load failed : le module sp?cifi? est introuvable.' |
Seems good to me. Could you put it in a PR? |
Unicode encoding in import errors - Fix for issue #346
There's a problem in that code in 1.2.6:
The _warn() call will throw a unicode-decode-error when run on a french OS, for instance:
<type 'exceptions.UnicodeDecodeError'> 'ascii' codec can't decode byte 0xe9 in position 59: ordinal not in range(128)
Possibly a missing .encode('utf-8') on msg?
The text was updated successfully, but these errors were encountered: