Author prikryl
Recipients BreamoreBoy, amaury.forgeotdarc, belopolsky, eryksun, jcea, msmhrt, ocean-city, prikryl, vstinner
Date 2015-09-21.21:43:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442871781.84.0.153894268157.issue16322@psf.upfronthosting.co.za>
In-reply-to
Content
@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?
History
Date User Action Args
2015-09-21 21:43:01prikrylsetrecipients: + prikryl, jcea, amaury.forgeotdarc, belopolsky, vstinner, ocean-city, BreamoreBoy, eryksun, msmhrt
2015-09-21 21:43:01prikrylsetmessageid: <1442871781.84.0.153894268157.issue16322@psf.upfronthosting.co.za>
2015-09-21 21:43:01prikryllinkissue16322 messages
2015-09-21 21:43:01prikrylcreate