Bugs item #1007046, was opened at 2004-08-11 06:47 Message generated for change (Settings changed) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1007046&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: Extension Modules Group: Python 2.3 Status: Closed Resolution: Fixed Priority: 5 Submitted By: Matthias Huening (huening) >Assigned to: Georg Brandl (gbrandl) >Summary: os.startfile() doesn\'t accept Unicode filenames Initial Comment: WinXP, Python 2.3.4 os.startfile() seems to have problems with Unicode filenames. Example: >>> import tkFileDialog >>> import os >>> f = tkFileDialog.askopenfilename() >>> type(f) <type 'unicode'> >>> os.startfile(f) Traceback (most recent call last): File "<pyshell#10>", line 1, in -toplevel- os.startfile(f) UnicodeEncodeError: 'ascii' codec can't encode characters in position 14-16: ordinal not in range(128) >>> ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2005-09-14 20:52 Message: Logged In: YES user_id=1188172 Checked this in now. posixmodule.c r2.340, r2.329.2.4. ---------------------------------------------------------------------- Comment By: M.-A. Lemburg (lemburg) Date: 2005-09-01 08:27 Message: Logged In: YES user_id=38388 The path looks OK, but I can't test it on Windows (os.startfile() is only available on Windows). A note on style: you should always try to keep lines shorter than 80 characters, e.g.: --- CVS-Python/Modules/posixmodule.c 2005-08-15 10:15:27.000000000 +0200 +++ Dev-Python/Modules/posixmodule.c 2005-09-01 10:23:06.555633134 +0200 @@ -7248,7 +7248,8 @@ { char *filepath; HINSTANCE rc; - if (!PyArg_ParseTuple(args, "s:startfile", &filepath)) + if (!PyArg_ParseTuple(args, "et:startfile", + Py_FileSystemDefaultEncoding, &filepath)) return NULL; Py_BEGIN_ALLOW_THREADS rc = ShellExecute((HWND)0, NULL, filepath, NULL, NULL, SW_SHOWNORMAL); ---------------------------------------------------------------------- Comment By: Raymond Hettinger (rhettinger) Date: 2005-08-24 05:18 Message: Logged In: YES user_id=80475 I'm unicode illiterate. Passing to MAL for review. ---------------------------------------------------------------------- Comment By: Georg Brandl (birkenfeld) Date: 2005-06-26 21:24 Message: Logged In: YES user_id=1188172 Attaching a patch which should fix that. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1007046&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com