[ python-Bugs-1681974 ] mkdtemp fails on Windows if username has non-ASCII character

SourceForge.net noreply at sourceforge.net
Wed Mar 21 12:42:09 CET 2007


Bugs item #1681974, was opened at 2007-03-16 10:03
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1681974&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Markus Niemistö (niemisto)
Assigned to: Nobody/Anonymous (nobody)
Summary: mkdtemp fails on Windows if username has non-ASCII character

Initial Comment:
mkdtemp fails miserably on Windows if Windows user name has any non-ASCII characters, like ä or ö, in it. mkdtemp throws an encoding error.

This seems to be because the default temp dir in Windows is "c:\documents and settings\<user name>\local settings\temp". Now if the user name has non-ASCII characters ASCII decoder cannot handle it and creating temp directories won't work.

As a work around I have used the following code:

tempdir = unicode(tempfile.gettempdir(), 'mbcs')
mkdtemp(suffix='foo', dir=tempdir)

This applies for both Python 2.4 and Python 2.5.

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

>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-21 11:42

Message:
Logged In: YES 
user_id=849994
Originator: NO

Could you indicate where exactly what error is raised?

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1681974&group_id=5470


More information about the Python-bugs-list mailing list