Skip to content

Commit 60fc345

Browse files
authored
Merge pull request #357 from friedererdmann/master
Unicode encoding in import errors - Fix for issue #346
2 parents 64e8162 + 460ff42 commit 60fc345

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Qt.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import json
4646

4747

48-
__version__ = "1.3.3"
48+
__version__ = "1.3.4"
4949

5050
# Enable support for `from Qt import *`
5151
__all__ = []
@@ -1260,6 +1260,14 @@ def _setup(module, extras):
12601260
Qt.__binding__ = module.__name__
12611261

12621262
def _warn_import_error(exc, module):
1263+
if sys.version_info > (3, 0):
1264+
unicode = str
1265+
else:
1266+
try:
1267+
if isinstance(exc, unicode):
1268+
exc = exc.encode('ascii', 'replace')
1269+
except (UnboundLocalError, NameError):
1270+
pass
12631271
msg = str(exc)
12641272
if "No module named" in msg:
12651273
return

0 commit comments

Comments
 (0)