jenkins-bot has submitted this change and it was merged.

Change subject: Decode __file__ using filesystem encoding
......................................................................


Decode __file__ using filesystem encoding

If the python packages loaded are in a non-ASCII named directory,
pywikibot on Python 2.x fails with UnicodeDecodeError.

Decode the __file__ values with sys.getfilesystemencoding().

Bug: 69476
Change-Id: I74c8d08b48b4f03ef38ccdbfce8ff3e5886289d5
---
M pywikibot/version.py
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Mpaa: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/version.py b/pywikibot/version.py
index 7e232a1..e82f0c5 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -346,6 +346,9 @@
             if '__init__.py' in path:
                 path = path[0:path.index('__init__.py')]
 
+            if sys.version_info[0] == 2:
+                path = path.decode(sys.getfilesystemencoding())
+
             info['path'] = path
             assert(path not in paths)
             paths[path] = name

-- 
To view, visit https://gerrit.wikimedia.org/r/167011
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I74c8d08b48b4f03ef38ccdbfce8ff3e5886289d5
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: John Vandenberg <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Merlijn van Deen <[email protected]>
Gerrit-Reviewer: Mpaa <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to