[New-bugs-announce] [issue23315] tempfile.mkdtemp fails with non-ascii paths on Python 2

Akira Li report at bugs.python.org
Sun Jan 25 12:02:16 CET 2015


New submission from Akira Li:

Python 2.7.9 (default, Jan 25 2015, 13:41:30) 
  [GCC 4.9.2] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import os, sys, tempfile
  >>> d = u'\u20ac'.encode(sys.getfilesystemencoding()) # non-ascii
  >>> if not os.path.isdir(d): os.makedirs(d)
  ... 
  >>> os.environ['TEMP'] = d
  >>> tempfile.mkdtemp(prefix=u'')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File ".../python2.7/tempfile.py", line 331, in mkdtemp
      file = _os.path.join(dir, prefix + name + suffix)
    File ".../python2.7/posixpath.py", line 80, in join
      path += '/' + b
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 13: ordinal not in range(128)

Related: https://bugs.python.org/issue1681974

----------
components: Unicode
messages: 234662
nosy: akira, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: tempfile.mkdtemp fails with non-ascii paths on Python 2
type: behavior
versions: Python 2.7

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


More information about the New-bugs-announce mailing list