This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients ezio.melotti, mark.dickinson
Date 2010-03-13.20:02:22
SpamBayes Score 1.8302027e-13
Marked as misclassified No
Message-id <1268510545.68.0.655630748834.issue8133@psf.upfronthosting.co.za>
In-reply-to
Content
test_issue5604 from test_imp is currently failing on OS X !0.6 (py3k branch), with the following output:

======================================================================
ERROR: test_issue5604 (__main__.ImportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_imp.py", line 121, in test_issue5604
    file, filename, info = imp.find_module(temp_mod_name)
ImportError: No module named test_imp_helper_ä

----------------------------------------------------------------------


I think this has something to do with the platform automatically
using NFD normalization for filenames.  Here's an interactive session: 

Python 3.2a0 (py3k:78936, Mar 13 2010, 19:42:52) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import imp, unicodedata
>>> fname = 'test' + b'\xc3\xa4'.decode('utf-8')
>>> with open(fname+'.py', 'w') as file: file.write('a = 1\n')
... 
6
>>> imp.find_module(fname)   # expected this to succeed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named testä
>>> imp.find_module(unicodedata.normalize('NFD', fname))
(<_io.TextIOWrapper name=4 encoding='utf-8'>, 'testä.py', ('.py', 'U', 1))


In contrast, a simple 'open' doesn't seem to care about normalization:

>>> open(fname+'.py')
<_io.TextIOWrapper name='testä.py' encoding='UTF-8'>
[50305 refs]
>>> open(unicodedata.normalize('NFD', fname)+'.py')
<_io.TextIOWrapper name='testä.py' encoding='UTF-8'>
[50305 refs]
History
Date User Action Args
2010-03-13 20:02:25mark.dickinsonsetrecipients: + mark.dickinson, ezio.melotti
2010-03-13 20:02:25mark.dickinsonsetmessageid: <1268510545.68.0.655630748834.issue8133@psf.upfronthosting.co.za>
2010-03-13 20:02:23mark.dickinsonlinkissue8133 messages
2010-03-13 20:02:23mark.dickinsoncreate