Petr Prikryl added the comment:
@eryksun: I see. In my case, I can set the locale before importing the time
module. However, the code (asciidoc3.py) will be used as a module, and I cannot
know if the user imported the time module or not.
Instead of your suggestion
result = result.encode('latin-1').decode('mbcs')
I was thinking to create a module say wordaround16322.py like this:
---------------
import locale
locale.setlocale(locale.LC_ALL, '')
import importlib
import time
importlib.reload(time)
---------------
I thought that reloading the time module would be the same as importing is
later, after setting locale. If that worked, the module could be simply
imported wherever it was needed. However, it does not work when imported after
importing time. What is the reason? Does reload() work
only for modules coded as Python sources? Is there any other approach that
would implement the workaroundXXX.py module?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16322>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com