Message251264
@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? |
|
Date |
User |
Action |
Args |
2015-09-21 21:43:01 | prikryl | set | recipients:
+ prikryl, jcea, amaury.forgeotdarc, belopolsky, vstinner, ocean-city, BreamoreBoy, eryksun, msmhrt |
2015-09-21 21:43:01 | prikryl | set | messageid: <1442871781.84.0.153894268157.issue16322@psf.upfronthosting.co.za> |
2015-09-21 21:43:01 | prikryl | link | issue16322 messages |
2015-09-21 21:43:01 | prikryl | create | |
|