Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100446
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | eryk sun <eryksun@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: cannot open file with non-ASCII filename |
| Date | Mon, 14 Dec 2015 21:20:18 -0600 |
| Lines | 50 |
| Message-ID | <mailman.10.1450149661.22044.python-list@python.org> (permalink) |
| References | <n4mqgm$v1d$1@news2.informatik.uni-stuttgart.de> <566F0BD0.8020106@udel.edu> <mailman.15.1450119109.14916.python-list@python.org> <n4nepp$4nb$1@news2.informatik.uni-stuttgart.de> <4412672.gUIyRlH8Kf@PointedEars.de> <201512150007.tBF07nMo021611@fido.openend.se> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de dRvFFLIT3ot+roFBOIvkqwfvb3SUVuv4RqDeTJXNeMjw== |
| Return-Path | <eryksun@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'url:sourceforge': 0.03; 'received:209.85.223': 0.03; 'testing,': 0.05; 'mask': 0.07; 'mouse': 0.07; 'subject:file': 0.07; 'url:msdn': 0.07; '[1]:': 0.09; '[2]:': 0.09; '[3]:': 0.09; 'closest': 0.09; 'creighton': 0.09; 'input,': 0.09; 'output,': 0.09; 'url:github': 0.09; 'bug': 0.10; 'python': 0.10; '2.7': 0.13; 'instead.': 0.15; '[1].': 0.16; 'api,': 0.16; 'bitwise': 0.16; 'curses': 0.16; 'instead:': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:non': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'frameworks': 0.18; 'laura': 0.18; 'creates': 0.18; 'gui': 0.18; 'input': 0.18; 'windows': 0.20; '2015': 0.20; 'extension': 0.20; '(the': 0.22; 'keyboard': 0.22; 'platform,': 0.22; 'dec': 0.23; 'matching': 0.23; 'url:edu': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'module': 0.25; 'skip:" 20': 0.26; 'message-id:@mail.gmail.com': 0.27; '14,': 0.27; '[2]': 0.27; 'module.': 0.27; 'said,': 0.27; 'function': 0.28; "skip:' 10": 0.28; 'character': 0.29; 'random': 0.29; 'code': 0.30; 'skip:[ 10': 0.31; "i'd": 0.31; 'skip:_ 10': 0.32; 'url:python': 0.33; 'builds': 0.33; 'file': 0.34; 'worked': 0.34; 'received:google.com': 0.35; 'text': 0.35; 'maps': 0.35; 'unicode': 0.35; 'should': 0.36; 'instead': 0.36; 'url:org': 0.36; 'received:209.85': 0.36; 'url:library': 0.36; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'version': 0.38; 'received:209': 0.38; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'url:3': 0.60; 'high': 0.60; 'skip:u 10': 0.61; 'avoid': 0.61; 'linked': 0.63; 'url:%20': 0.63; 'news': 0.68; 'url:en-us': 0.72; '8bit%:92': 0.72; 'url:htm': 0.75; 'hitch': 0.84; 'latin': 0.84; 'toolkit.': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=whVSCd8Wr6/NcbI+6+Qx9XC/iKDk1MEU43GyXmmKEyQ=; b=glxo+vLaSdQRXlbR7yyAz3mW+eLqAp/8xOiyb3y6mqxsf2dJJoWN/7+naVEw+/HYk2 lTDfzi1oOP6sehoCNSc74pGOLTG5jlUQv5VhCslx0UsTB2jfDaTXJHA+w5kmiNOM+g2M hyHl7Ng5fZVRebOLxm7H9tGWOKii3cP3+kiCKBU8CEO/I523SKxWoJTm8Y3ech7ZzXDK vo7+S9Bm70MamOMjVOX3or3qVZsg48kkMxHviKpzpyHgs0yEV7B/uYSHCV6MfHB+fJ3E JNWjVXN39YJwmf+NjViDZCWddaIbTn9+XiiffPBQC5GleKZHEKLXwvc1JxlJ7C6qtg3O giag== |
| X-Received | by 10.107.137.226 with SMTP id t95mr32377987ioi.188.1450149658524; Mon, 14 Dec 2015 19:20:58 -0800 (PST) |
| In-Reply-To | <201512150007.tBF07nMo021611@fido.openend.se> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:100446 |
Show key headers only | View raw
On Mon, Dec 14, 2015 at 6:07 PM, Laura Creighton <lac@openend.se> wrote: > In a message of Mon, 14 Dec 2015 23:41:21 +0100, "Thomas 'PointedEars' Lahn" wr > ites: > >>Why do you have to use msvcrt? >> >>I would use curses for user input, but: >> >>,-<https://docs.python.org/2/howto/curses.html?highlight=user%20input> >>,-<https://docs.python.org/3.2/howto/curses.html?highlight=user%20input> >>| >>| No one has made a Windows port of the curses module. On a Windows >>| platform, try the Console module written by Fredrik Lundh. The Console >>| module provides cursor-addressable text output, plus full support for >>| mouse and keyboard input, and is available from >>| http://effbot.org/zone/console-index.htm. >> >>So you should try that instead. > > If going for curses, I'd try this instead: > http://pdcurses.sourceforge.net/ Christoph Gohlke has an extension module based on PDCurses [1]. The good news for Python 3 users is that it uses the [W]ide-character console API, such as ReadConsoleInputW. Also, its _get_key_count [2] function is designed to support the alt numpad event sequences that the system creates for the input filepath when dragging a file into the console. In my limited testing, dragging filepaths from Explorer worked without a hitch using a random Latin-1 name "¨°¸ÀÈÐØàèðø" and a Latin Extended-B name "ƠƨưƸǀLjǐǘǠǨǰǸ". Unfortunately the Python 2.7 version is linked against the [A]NSI API, which maps each Unicode character to either the closest matching character in the console's codepage or "?". Moreover the PDCurses code has a bug in narrow builds in that it returns the UnicodeChar from the KEY_EVENT_RECORD [3] instead of the AsciiChar (the name is a misnomer). In this case the high byte is junk. You can mask it out using a bitwise & with 0xFF. That said, IIRC, the OP wants to avoid using any frameworks such as curses or a GUI toolkit. [1]: http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses [2]: https://github.com/wmcbrine/PDCurses/blob/PDCurses_3_4/win32/pdckbd.c#L259 [3]: https://msdn.microsoft.com/en-us/library/ms684166
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cannot open file with non-ASCII filename Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-14 16:24 +0000
Re: cannot open file with non-ASCII filename Terry Reedy <tjreedy@udel.edu> - 2015-12-14 13:34 -0500
Re: cannot open file with non-ASCII filename wxjmfauth@gmail.com - 2015-12-14 11:07 -0800
Re: cannot open file with non-ASCII filename eryk sun <eryksun@gmail.com> - 2015-12-14 12:45 -0600
Re: cannot open file with non-ASCII filename Laura Creighton <lac@openend.se> - 2015-12-14 19:51 +0100
Re: cannot open file with non-ASCII filename Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-14 22:11 +0000
Re: cannot open file with non-ASCII filename Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-14 23:41 +0100
Re: cannot open file with non-ASCII filename Laura Creighton <lac@openend.se> - 2015-12-15 01:07 +0100
Re: cannot open file with non-ASCII filename eryk sun <eryksun@gmail.com> - 2015-12-14 21:20 -0600
Re: cannot open file with non-ASCII filename eryk sun <eryksun@gmail.com> - 2015-12-14 17:55 -0600
Re: cannot open file with non-ASCII filename Laura Creighton <lac@openend.se> - 2015-12-15 01:13 +0100
Re: cannot open file with non-ASCII filename Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-15 08:26 +0000
Re: cannot open file with non-ASCII filename Laura Creighton <lac@openend.se> - 2015-12-15 15:09 +0100
Re: cannot open file with non-ASCII filename eryk sun <eryksun@gmail.com> - 2015-12-15 09:34 -0600
Re: cannot open file with non-ASCII filename Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2015-12-15 17:04 +0000
Re: cannot open file with non-ASCII filename eryk sun <eryksun@gmail.com> - 2015-12-16 21:39 -0600
Re: cannot open file with non-ASCII filename smap <askme.first@thankyouverymuch.invalid> - 2015-12-18 21:15 +0000
cannot open file with non-ASCII filename bearmingo <bearmingo@gmail.com> - 2015-12-17 21:12 -0800
Re: cannot open file with non-ASCII filename Terry Reedy <tjreedy@udel.edu> - 2015-12-18 01:37 -0500
csiph-web