jayvdb added a subscriber: jayvdb.
jayvdb added a comment.

In https://phabricator.wikimedia.org/T120222#1862302, @valhallasw wrote:

> System error code 2 / The system cannot find the file specified. This is 
> localized, so it's 'Het systeem kan het opgegeven bestand niet vinden' in 
> Dutch and e.g. 'Le système ne trouve pas le fichier spécifié.' in French. On 
> Python 2, that's a str encoded in the current locale (win-1252 for French), 
> which of course does not decode as ascii.


I believe this is caused by Windows locale being quite different.  I believe on 
Windows, some parts of the locale are the user locale on startup, whereas on 
Unix the locale is `C` until `locale.setlocale(LC_ALL, '')` is invoked.  Only 
`welcome.py` sets the locale to the user locale, but that happens after 
`config2.py` is loaded.

My guess is that `welcome.py` on Linux would also have problems any time it 
encounters an `OSError`, which uses `strerror`.

http://stackoverflow.com/questions/18397572/python-ioerror-strerror-is-not-unicode
https://bugs.launchpad.net/bzr/+bug/273978

I havent found a good recipe for fixing this; my first guess is we should have 
a wrapper `Exception` subclass which does the decoding for `OSError`, and/or 
add special handling of `OSError` in `pywikibot.logging.exception`.


TASK DETAIL
  https://phabricator.wikimedia.org/T120222

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: jayvdb
Cc: jayvdb, Ladsgroup, XZise, valhallasw, Aklapper, WereSpielChequers, 
StudiesWorld, Lokal_Profil, pywikibot-bugs-list



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

Reply via email to