Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100420

Re: cannot open file with non-ASCII filename

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Laura Creighton <lac@openend.se>
Newsgroups comp.lang.python
Subject Re: cannot open file with non-ASCII filename
Date Mon, 14 Dec 2015 19:51:45 +0100
Lines 33
Message-ID <mailman.15.1450119109.14916.python-list@python.org> (permalink)
References <n4mqgm$v1d$1@news2.informatik.uni-stuttgart.de> <566F0BD0.8020106@udel.edu>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de z1KTTyNq9j9HSAaTvryILAy8EFIe95klYcUX30zmU1NQ==
Return-Path <lac@openend.se>
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; 'root': 0.04; '-*-': 0.07; 'filenames': 0.07; 'subject:file': 0.07; 'coding:': 0.09; 'non- ascii': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'unicode,': 0.09; 'python': 0.10; 'jan': 0.11; '>on': 0.16; 'filenames.': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'subject:non': 0.16; 'tk()': 0.16; 'wrote:': 0.16; 'laura': 0.18; 'windows': 0.20; '2015': 0.20; '3.x': 0.22; 'ascii': 0.22; 'class,': 0.22; 'tkinter': 0.22; 'am,': 0.23; '(or': 0.23; '(where': 0.23; 'dec': 0.23; 'performing': 0.23; 'this:': 0.23; 'import': 0.24; 'mon,': 0.24; 'restrict': 0.27; 'fine': 0.28; '-0500,': 0.29; 'received:se': 0.29; 'themselves': 0.29; 'url:mailman': 0.30; 'fixed': 0.31; 'core': 0.32; 'possibly': 0.32; 'url:python': 0.33; 'him.': 0.33; 'url:listinfo': 0.34; 'text': 0.35; 'unicode': 0.35; 'should': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'files': 0.38; 'subject:-': 0.39; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'header:Message-Id:1': 0.61; 'further': 0.62; 'making': 0.62; '>with': 0.84; 'header:In-reply-to:1': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=openend.se; s=default; t=1450119107; bh=QB0+SC2WKxQIJoyr49K/YPFL9406bzSNZzxutv7PSS8=; h=To:From:Subject:In-reply-to:References:Date:From; b=KAVLJkTtKXeyFxNp1E5fLUqmvURurrroTgXCiUfpxZkk6oqtwUqei/R5JnPDOdGQ/ tNh9U5OIZbXcOvQICiTtMKXS82+PVP01L3lf96VgOMyGH43WqVuwX0l4LdjB5rhoYa oriZEhFsMv+OjaTkEnu+fYDosLaRO+Cq43JxVNG0=
In-reply-to <566F0BD0.8020106@udel.edu>
Comments In-reply-to Terry Reedy <tjreedy@udel.edu> message dated "Mon, 14 Dec 2015 13:34:56 -0500."
Content-ID <18007.1450119105.1@fido>
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Mon, 14 Dec 2015 19:51:47 +0100 (CET)
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:100420

Show key headers only | View raw


In a message of Mon, 14 Dec 2015 13:34:56 -0500, Terry Reedy writes:
>On 12/14/2015 11:24 AM, Ulli Horlacher wrote:
>> With Python 2.7.11 on Windows 7 my users cannot open/read files with
>> non-ASCII filenames.
>
>Right.  They should either restrict themselves to ascii (or possibly 
>latin-1) filenames or use current 3.x.  This is one of the (known) 
>unicode problems fixed in 3.x by making unicode the core text class, 
>replacing the implementation of unicode, and performing further work 
>with the new implementation.
>
>-- 
>Terry Jan Reedy
>
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Given that Ulli is in Germany, latin-1 is likely to work fine for him.  And
you do it like this:

# -*- coding: latin-1 -*-
from Tkinter import *
root = Tk()
s = 'Välkommen till Göteborg'  # Welcome to Gothenburg (where I live)
u = unicode(s, 'iso8859-1')
Label(root, text=u).pack()

root.mainloop()

Laura


Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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