[New-bugs-announce] [issue23797] Mac OS X locale setup in thread happens sometime after run() is called

Barry Alan Scott report at bugs.python.org
Sat Mar 28 11:47:55 CET 2015


New submission from Barry Alan Scott:

I'm seeing a random traceback when starting a new thread on Mac OS X 10.10.2 with python 3.4.3 final.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/Users/barry/wc/svn/pysvn-phoenix/WorkBench/Source/wb_background_thread.py", line 40, in run
    self.app.log.info( 'BackgroundThread locale %r' % (locale.getlocale(),) )
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/locale.py", line 575, in getlocale
    return _parse_localename(localename)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/locale.py", line 484, in _parse_localename
    raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8

Adding a time.sleep( 5 ) prevents the traceback.

Using _locale.setlocale( locale.LC_ALL, None ) to see the state with locale.py interfering it looks like the locale is being initialised in the thread after run() is called. (Make no sense to me, but I can reproduce).

I have failed to create a small script to show this bug.

----------
messages: 239458
nosy: barry-scott
priority: normal
severity: normal
status: open
title: Mac OS X locale setup in thread happens sometime after run() is called
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23797>
_______________________________________


More information about the New-bugs-announce mailing list