Re: How can I get/save Pandas DataFrame help content?

2015-12-17 Thread Peter Otten
Robert wrote:

> Hi,
> 
> When I use Enthought/Canopy, help(DataFrame) has so much content that it
> exceeds the display buffer, i.e. its head is cut off as I go up to see it.
> I would like to know whether there is a way similar to Linux redirection
> to save the help DataFrame content to a file?
> 
> I have search on-line Pandas DataFrame web page. Surprisingly, it has much
> less content than help(DataFrame) command.
> 
> If there is no way to save the content to a file, do you know where I can
> get the full help DataFrame content on a web page?

On the commandline start a webserver with

python -m pydoc -p 8000

and then point your browser to

http://localhost:8000/pandas.core.frame.html#DataFrame

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-17 Thread Michiel Overtoom

> On 2015-12-17, at 01:03, Bruce Whealton  
> wrote:
> 
> I would want to package in some way so that when launched, it installs 
> whatever is needed on the end user's computer. How is this done? 

You might want to watch https://www.youtube.com/watch?v=wsczq6j3_bA (Brandon 
Rhodes: The Day of the EXE Is Upon Us - PyCon 2014). 

"It was once quite painful to build your Python app as a single .exe file. 
Support forums filled with lamentations as users struggled with primitive 
tools. But today, two separate tools exist for compiling your Python to real 
machine language! Come learn about how one of the biggest problems in 
commercial and enterprise software has now been solved and how you can benefit 
from this achievement.

Slides can be found at: https://speakerdeck.com/pycon2014 and 
https://github.com/PyCon/2014-slides";

Greetings,


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why my image is in bad quality ?

2015-12-17 Thread fsn761304
On Thursday, December 17, 2015 at 5:27:28 AM UTC+4, Nobody wrote:
> On Wed, 16 Dec 2015 06:04:37 -0800, fsn761304 wrote:
> 
> > pixbufObj = Gdk.pixbuf_get_from_window(window, x, y, width, height) ...
> > image = Image.frombuffer("RGB", (width, height),
> >  pixbufObj.get_pixels(), 'raw', 'RGB', 0, 1)
> 
> The second-to-last argument should probably be Gdk.pixbuf_get_rowstride()
> rather than 0.

No, this:
image = Image.frombuffer("RGB", (width, height), 
 pixbufObj.get_pixels(), 'raw', 'RGB', 
Gdk.pixbuf_get_rowstride(), 1)

doesn't work:

AttributeError: 'gi.repository.Gdk' object has no attribute 
'pixbuf_get_rowstride'
-- 
https://mail.python.org/mailman/listinfo/python-list


Hangman Code.

2015-12-17 Thread trkaplan24
Hello, I created a python code for a simple hangman game. Was wondering if 
anyone could edit to help me make it multiplayer so when one person guesses a 
letter incorrectly, the next player can then guess a letter. 

import time
player1 = raw_input("What is your name Player 1? ")
player2 = raw_input("What is your name Player 2? ")

print "Hello, " + player1, "You get to go first!"
print "Hello, " + player2, "Wait for your turn!"

print "\n"
time.sleep(1)
print "Start guessing..."
time.sleep(0.5)
word = "hockey"
guesses = ''
turns = 10
while turns > 0:
failed = 0
for char in word:
if char in guesses:
print char,
else:
print "_",
failed += 1
if failed == 0:
print "\nYou won"
break
print
guess = raw_input("guess a character:")
guesses += guess
if guess not in word:
turns -= 1
print "Wrong\n"
print "You have", + turns, 'guesses left'
if turns == 0:
print "You Lose\n"

Thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


python 3.4, os.walk does not walk into cdroms

2015-12-17 Thread Siegfried Kaiser
Hello all,

 I have a problem with os.walk - it does not walk into a mounted cdrom, I do 
not see the cdrom in the walk at all.
What can I do to walk into cdrom?

Thanks,
Siegfried

-- 
Siegfried Kaiser 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 3.4, os.walk does not walk into cdroms

2015-12-17 Thread Mark Lawrence

On 17/12/2015 13:03, Siegfried Kaiser wrote:

Hello all,

  I have a problem with os.walk - it does not walk into a mounted cdrom, I do 
not see the cdrom in the walk at all.
What can I do to walk into cdrom?

Thanks,
 Siegfried



Please give us.

1) Your OS.
2) Your code.
3) How you tried to run it.
4) Exactly what happened.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-17 Thread Ulli Horlacher
Rick Johnson  wrote:

> Unlike a true "applications language", like say, um, *JAVA*, one cannot
> simply compile an executable and distribute it in a teeny tiny binary
> form, no, with Python

Of course you can!
If have done this with pyinstaller. This creates a standalone Windows
executable you can distribute.
Example:
http://fex.rus.uni-stuttgart.de:8080/fexit.html




-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: [email protected]
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hangman Code.

2015-12-17 Thread Denis McMahon
On Thu, 17 Dec 2015 05:28:23 -0800, trkaplan24 wrote:

> Hello, I created a python code for a simple hangman game. Was wondering
> if anyone could edit to help me make it multiplayer so when one person
> guesses a letter incorrectly, the next player can then guess a letter.

First you need to prompt for the number of players, and store this in a 
variable.

Next you need a variable to keep track of the current player. Set this to 
1 at the start of the program, because we're humans and we like to be 
player 1 ... player n, not player 0 ... player n-1.

Use the current player variable value to prompt for the next player.

After each player takes a turn, add 1 to the current player. If this is 
greater than the number of players, set it back to 1.

-- 
Denis McMahon, [email protected]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tk alternative to askopenfilename and askdirectory?

2015-12-17 Thread Ulli Horlacher
Rick Johnson  wrote:

> Oh i understand. What you opine for is something like: askOpenFileOrDir()
> -- which displays a dialog from which a file or directory can be selected
> by the user. 

Yes, exactly!
Now: how?

-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: [email protected]
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can I get/save Pandas DataFrame help content?

2015-12-17 Thread Robert Kern

On 2015-12-17 04:09, Steven D'Aprano wrote:

On Thursday 17 December 2015 13:48, Robert wrote:


Hi,

When I use Enthought/Canopy, help(DataFrame) has so much content that it
exceeds the display buffer, i.e. its head is cut off as I go up to see it.



Step 1: report this as a bug to Enthought and/or the Python bug tracker.
help(DataFrame) should automatically choose a pager such as `less` on Linux
or equivalent (`more` I think?) on Windows.


I suspect that he is using the embedded IPython console in the Canopy IDE, so 
it's more of an issue that help() knows that it's not in a true terminal so it 
doesn't page. If he had been using python at the terminal, help() would have 
indeed used the appropriate terminal pager.


Robert, in the IPython console, you can also use a special syntax to get the 
content. The IPython console widget does know how to page this:


  In [1]: pandas.DataFrame?

http://ipython.readthedocs.org/en/stable/interactive/reference.html#dynamic-object-information

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

--
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-17 Thread Oscar Benjamin
On 17 December 2015 at 00:03, Bruce Whealton
 wrote:
> I watched one training video that discussed Python and Tkinter. Like many 
> similar tutorials from online training sites, I was left scratching my head.
>
> What seems to be blatantly missing is how this would be distributed. In the 
> first mentioned tutorial from Lynda.com the Tkinter app was related to a web 
> page. However, the browser cannot run Python Bytecode or Python Scripts.
>
> Surely, one is going to want to create GUI apps for users that are not Python 
> Developers. I would not think to ask someone to install Python on their 
> system and make sure it is added to the path. Maybe it is not so hard for the 
> non-technical, average users.
>
> I would want to package in some way so that when launched, it installs 
> whatever is needed on the end user's computer. How is this done?
> Are there common practices for this?

There are different general approaches in this area. One possibility
is to ship an installer. Another is to try and ship a complete single
file executable. For the single-file executable you have
pyinstaller/py2exe/py2app etc.

If you're user can be expected to install the software before running
it then in the basic case it is not too hard. Python itself comes with
a graphical installer for Windows and is already installed on every
other OS. If you can assume that Python is installed then you can
distribute your application simply as a zip file but with a .py(z)(w)
file extension.

See here:
https://www.python.org/dev/peps/pep-0441/

A Windows user should then be able to simply double click the .pyz
file and have it run. I'm not sure how that works on a MAC but on
Linux you can preface the zip file with a shebang make it executable
and it will run from the terminal and from any file-browser if it
knows how to run executable files.

Another option for Windows although it is relatively new is that as of
Python 3.5 there is an embedded distribution of Python that is
intended to be shipped as part of an application installer and
installed local to the application. This is new and I haven't heard
anyone using it and don't know if any tools exist to help actually
creating an installer using it.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: error reading api with urllib

2015-12-17 Thread Simian
I will try adding the get.

I have not used curl.

I also forgot to mention that the code runs against another server, though a 
slightly different version number.

Thanks to you both.

Simian
-- 
https://mail.python.org/mailman/listinfo/python-list


Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Mark Lawrence
The culprit character is hidden between "Issue #" and "20540" at line 
400 of C:\Python35\Lib\multiprocessing\connection.py. 
https://bugs.python.org/issue20540 and 
https://hg.python.org/cpython/rev/125c24f47f3c refers.


I'm asking as I've just spent 30 minutes tracking down why my debug code 
would bomb when running on 3.5, but not 2.7 or 3.2 through 3.4.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Ian Kelly
On Thu, Dec 17, 2015 at 4:05 PM, Mark Lawrence  wrote:
> The culprit character is hidden between "Issue #" and "20540" at line 400 of
> C:\Python35\Lib\multiprocessing\connection.py.
> https://bugs.python.org/issue20540 and
> https://hg.python.org/cpython/rev/125c24f47f3c refers.
>
> I'm asking as I've just spent 30 minutes tracking down why my debug code
> would bomb when running on 3.5, but not 2.7 or 3.2 through 3.4.

Probably not, but that's inside a comment, so whether the character is
U+202F or U+0020 shouldn't make any difference in how the code runs.
That seems like a Unicode bug if it does.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Chris Angelico
On Fri, Dec 18, 2015 at 10:05 AM, Mark Lawrence  wrote:
> The culprit character is hidden between "Issue #" and "20540" at line 400 of
> C:\Python35\Lib\multiprocessing\connection.py.
> https://bugs.python.org/issue20540 and
> https://hg.python.org/cpython/rev/125c24f47f3c refers.
>
> I'm asking as I've just spent 30 minutes tracking down why my debug code
> would bomb when running on 3.5, but not 2.7 or 3.2 through 3.4.

I'm curious as to why this character should bomb your code at all -
it's in a comment. Is it that your program was expecting ASCII, or is
it something about that particular character?

Here's a quick listing of the CPython standard library files that aren't ASCII:

rosuav@sikorsky:~/cpython/Lib$ find -name \*.py -not -wholename
\*test\* -exec file {} \;|grep UTF-8
./encodings/punycode.py: Python script, UTF-8 Unicode text executable
./encodings/koi8_t.py: Python script, UTF-8 Unicode text executable
./msilib/__init__.py: Python script, UTF-8 Unicode text executable
./shlex.py: Python script, UTF-8 Unicode text executable
./http/client.py: Python script, UTF-8 Unicode text executable
./distutils/command/bdist_msi.py: Python script, UTF-8 Unicode text executable
./multiprocessing/connection.py: Python script, UTF-8 Unicode text executable
./functools.py: Python script, UTF-8 Unicode text executable
./heapq.py: Python script, UTF-8 Unicode text executable
./email/message.py: Python script, UTF-8 Unicode text executable
./getopt.py: Python script, UTF-8 Unicode text executable
./urllib/request.py: Python script, UTF-8 Unicode text executable
./sre_compile.py: Python script, UTF-8 Unicode text executable
./sqlite3/dbapi2.py: Python script, UTF-8 Unicode text executable
./sqlite3/__init__.py: Python script, UTF-8 Unicode text executable

Does your program bomb on any of these?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Mark Lawrence

On 17/12/2015 23:18, Chris Angelico wrote:

On Fri, Dec 18, 2015 at 10:05 AM, Mark Lawrence  wrote:

The culprit character is hidden between "Issue #" and "20540" at line 400 of
C:\Python35\Lib\multiprocessing\connection.py.
https://bugs.python.org/issue20540 and
https://hg.python.org/cpython/rev/125c24f47f3c refers.

I'm asking as I've just spent 30 minutes tracking down why my debug code
would bomb when running on 3.5, but not 2.7 or 3.2 through 3.4.


I'm curious as to why this character should bomb your code at all -
it's in a comment. Is it that your program was expecting ASCII, or is
it something about that particular character?



I'm playing with ASTs and using the stdlib as test data.  I was trying 
to avoid going down this particular route, but...


A lot of it is down to Windows, as the actual complaint is:-

six.print_(source)
  File "C:\Python35\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u202f' in 
position 407: character maps to 


And as usual I've answered my own question.  The cp1252 shows even if my 
console is set to 65001, *BUT* I'm piping the output to file as it's so 
much faster.  Having taken five minutes to run the code without the pipe 
everything runs to completion.


I suppose the original question still holds, but I for one certainly 
won't be losing any sleep over it.  Talking of which, good night all :)


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Chris Angelico
On Fri, Dec 18, 2015 at 11:02 AM, Mark Lawrence  wrote:
> A lot of it is down to Windows, as the actual complaint is:-
>
> six.print_(source)
>   File "C:\Python35\lib\encodings\cp1252.py", line 19, in encode
> return codecs.charmap_encode(input,self.errors,encoding_table)[0]
> UnicodeEncodeError: 'charmap' codec can't encode character '\u202f' in
> position 407: character maps to 
>
> And as usual I've answered my own question.  The cp1252 shows even if my
> console is set to 65001, *BUT* I'm piping the output to file as it's so much
> faster.  Having taken five minutes to run the code without the pipe
> everything runs to completion.
>
> I suppose the original question still holds, but I for one certainly won't
> be losing any sleep over it.  Talking of which, good night all :)

Oh. Windows.

Suddenly it all makes sense.

Python source code is (as of 3.0) Unicode text, and is assumed to be
stored as UTF-8 if not otherwise specified. If Windows can't handle
that, too bad for Windows.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


cannot open file with non-ASCII filename

2015-12-17 Thread bearmingo
Usually I put 
#!-*-coding=utf-8-*-
at each py file.
It's ok to open file in local system.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Terry Reedy

On 12/17/2015 6:18 PM, Chris Angelico wrote:

On Fri, Dec 18, 2015 at 10:05 AM, Mark Lawrence  wrote:

The culprit character is hidden between "Issue #" and "20540" at line 400 of
C:\Python35\Lib\multiprocessing\connection.py.
https://bugs.python.org/issue20540 and
https://hg.python.org/cpython/rev/125c24f47f3c refers.

I'm asking as I've just spent 30 minutes tracking down why my debug code
would bomb when running on 3.5, but not 2.7 or 3.2 through 3.4.


I'm curious as to why this character should bomb your code at all -
it's in a comment. Is it that your program was expecting ASCII, or is
it something about that particular character?

Here's a quick listing of the CPython standard library files that aren't ASCII:


Last I knew, Guido still wanted stdlib files to be all-ascii, especially 
possibly in special cases. There is no good reason I can think of for 
there to be an invisible non-ascii space in a comment.  It strikes me as 
most likely an accident (typo) that should be fixed.  I suspect the same 
of most of the following.  Perhaps you should file an issue (and patch?) 
on the tracker.



rosuav@sikorsky:~/cpython/Lib$ find -name \*.py -not -wholename
\*test\* -exec file {} \;|grep UTF-8
./encodings/punycode.py: Python script, UTF-8 Unicode text executable
./encodings/koi8_t.py: Python script, UTF-8 Unicode text executable
./msilib/__init__.py: Python script, UTF-8 Unicode text executable
./shlex.py: Python script, UTF-8 Unicode text executable
./http/client.py: Python script, UTF-8 Unicode text executable
./distutils/command/bdist_msi.py: Python script, UTF-8 Unicode text executable
./multiprocessing/connection.py: Python script, UTF-8 Unicode text executable
./functools.py: Python script, UTF-8 Unicode text executable
./heapq.py: Python script, UTF-8 Unicode text executable
./email/message.py: Python script, UTF-8 Unicode text executable
./getopt.py: Python script, UTF-8 Unicode text executable
./urllib/request.py: Python script, UTF-8 Unicode text executable
./sre_compile.py: Python script, UTF-8 Unicode text executable
./sqlite3/dbapi2.py: Python script, UTF-8 Unicode text executable
./sqlite3/__init__.py: Python script, UTF-8 Unicode text executable

Does your program bomb on any of these?

ChrisA




--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: cannot open file with non-ASCII filename

2015-12-17 Thread Terry Reedy

On 12/18/2015 12:12 AM, bearmingo wrote:

Usually I put
#!-*-coding=utf-8-*-
at each py file.
It's ok to open file in local system.


That declaration only applies to the content of the file, not its name 
on the filesystem.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Chris Angelico
On Fri, Dec 18, 2015 at 5:36 PM, Terry Reedy  wrote:
> Last I knew, Guido still wanted stdlib files to be all-ascii, especially
> possibly in special cases. There is no good reason I can think of for there
> to be an invisible non-ascii space in a comment.  It strikes me as most
> likely an accident (typo) that should be fixed.  I suspect the same of most
> of the following.  Perhaps you should file an issue (and patch?) on the
> tracker.

You're probably right on that one. Here's others - and the script I
used to find them.

import os
for root, dirs, files in os.walk("."):
if "test" in root: continue
for fn in files:
if not fn.endswith(".py"): continue
if "test" in fn: continue
with open(os.path.join(root,fn),"rb") as f:
for l,line in enumerate(f):
try:
line.decode("ascii")
continue # Ignore the ASCII lines
except UnicodeDecodeError:
line = line.rstrip(b"\n")
try: line = line.decode("UTF-8")
except UnicodeDecodeError: line = repr(line) # If
it's not UTF-8 either, show it as b'...'
print("%s:%d: %s" % (fn,l,line))


shlex.py:37: self.wordchars += ('ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
shlex.py:38:'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')
functools.py:7: # and Łukasz Langa .
heapq.py:34: [explanation by François Pinard]
getopt.py:21: # Peter Åstrand  added gnu_getopt().
sre_compile.py:26: (0x69, 0x131), # iı
sre_compile.py:28: (0x73, 0x17f), # sſ
sre_compile.py:30: (0xb5, 0x3bc), # µμ
sre_compile.py:32: (0x345, 0x3b9, 0x1fbe), # \u0345ιι
sre_compile.py:34: (0x390, 0x1fd3), # ΐΐ
sre_compile.py:36: (0x3b0, 0x1fe3), # ΰΰ
sre_compile.py:38: (0x3b2, 0x3d0), # βϐ
sre_compile.py:40: (0x3b5, 0x3f5), # εϵ
sre_compile.py:42: (0x3b8, 0x3d1), # θϑ
sre_compile.py:44: (0x3ba, 0x3f0), # κϰ
sre_compile.py:46: (0x3c0, 0x3d6), # πϖ
sre_compile.py:48: (0x3c1, 0x3f1), # ρϱ
sre_compile.py:50: (0x3c2, 0x3c3), # ςσ
sre_compile.py:52: (0x3c6, 0x3d5), # φϕ
sre_compile.py:54: (0x1e61, 0x1e9b), # ṡẛ
sre_compile.py:56: (0xfb05, 0xfb06), # ſtst
punycode.py:2: Written by Martin v. Löwis.
koi8_t.py:2: # http://ru.wikipedia.org/wiki/КОИ-8
__init__.py:0: # Copyright (C) 2005 Martin v. Löwis
client.py:737: a Date representing the file’s last-modified time, a
client.py:739: containing a guess at the file’s type. See also the
bdist_msi.py:0: # Copyright (C) 2005, 2006 Martin von Löwis
connection.py:399: # Issue # 20540: concatenate before
sending, to avoid delays due
message.py:531:filename=('utf-8', '', Fußballer.ppt'))
message.py:533:filename='Fußballer.ppt'))
request.py:181: * geturl() — return the URL of the resource
retrieved, commonly used to
request.py:184: * info() — return the meta-information of the
page, such as headers, in the
request.py:188: * getcode() – return the HTTP status code of the
response.  Raises URLError
dbapi2.py:2: # Copyright (C) 2004-2005 Gerhard Häring 
__init__.py:2: # Copyright (C) 2005 Gerhard Häring 

They're nearly all comments. A few string literals.

I would be inclined to ASCIIfy the apostrophes, dashes, and the
connection.py space that started this thread. People's names, URLs,
and demonstrative characters I'm more inclined to leave. Agreed?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Serhiy Storchaka

On 18.12.15 08:51, Chris Angelico wrote:

On Fri, Dec 18, 2015 at 5:36 PM, Terry Reedy  wrote:

Last I knew, Guido still wanted stdlib files to be all-ascii, especially
possibly in special cases. There is no good reason I can think of for there
to be an invisible non-ascii space in a comment.  It strikes me as most
likely an accident (typo) that should be fixed.  I suspect the same of most
of the following.  Perhaps you should file an issue (and patch?) on the
tracker.


You're probably right on that one. Here's others - and the script I
used to find them.

import os
for root, dirs, files in os.walk("."):
 if "test" in root: continue
 for fn in files:
 if not fn.endswith(".py"): continue
 if "test" in fn: continue
 with open(os.path.join(root,fn),"rb") as f:
 for l,line in enumerate(f):
 try:
 line.decode("ascii")
 continue # Ignore the ASCII lines
 except UnicodeDecodeError:
 line = line.rstrip(b"\n")
 try: line = line.decode("UTF-8")
 except UnicodeDecodeError: line = repr(line) # If
it's not UTF-8 either, show it as b'...'
 print("%s:%d: %s" % (fn,l,line))


shlex.py:37: self.wordchars += ('ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
shlex.py:38:'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')
functools.py:7: # and Łukasz Langa .
heapq.py:34: [explanation by François Pinard]
getopt.py:21: # Peter Åstrand  added gnu_getopt().
sre_compile.py:26: (0x69, 0x131), # iı
sre_compile.py:28: (0x73, 0x17f), # sſ
sre_compile.py:30: (0xb5, 0x3bc), # µμ
sre_compile.py:32: (0x345, 0x3b9, 0x1fbe), # \u0345ιι
sre_compile.py:34: (0x390, 0x1fd3), # ΐΐ
sre_compile.py:36: (0x3b0, 0x1fe3), # ΰΰ
sre_compile.py:38: (0x3b2, 0x3d0), # βϐ
sre_compile.py:40: (0x3b5, 0x3f5), # εϵ
sre_compile.py:42: (0x3b8, 0x3d1), # θϑ
sre_compile.py:44: (0x3ba, 0x3f0), # κϰ
sre_compile.py:46: (0x3c0, 0x3d6), # πϖ
sre_compile.py:48: (0x3c1, 0x3f1), # ρϱ
sre_compile.py:50: (0x3c2, 0x3c3), # ςσ
sre_compile.py:52: (0x3c6, 0x3d5), # φϕ
sre_compile.py:54: (0x1e61, 0x1e9b), # ṡẛ
sre_compile.py:56: (0xfb05, 0xfb06), # ſtst
punycode.py:2: Written by Martin v. Löwis.
koi8_t.py:2: # http://ru.wikipedia.org/wiki/КОИ-8
__init__.py:0: # Copyright (C) 2005 Martin v. Löwis
client.py:737: a Date representing the file’s last-modified time, a
client.py:739: containing a guess at the file’s type. See also the
bdist_msi.py:0: # Copyright (C) 2005, 2006 Martin von Löwis
connection.py:399: # Issue # 20540: concatenate before
sending, to avoid delays due
message.py:531:filename=('utf-8', '', Fußballer.ppt'))
message.py:533:filename='Fußballer.ppt'))
request.py:181: * geturl() — return the URL of the resource
retrieved, commonly used to
request.py:184: * info() — return the meta-information of the
page, such as headers, in the
request.py:188: * getcode() – return the HTTP status code of the
response.  Raises URLError
dbapi2.py:2: # Copyright (C) 2004-2005 Gerhard Häring 
__init__.py:2: # Copyright (C) 2005 Gerhard Häring 

They're nearly all comments. A few string literals.

I would be inclined to ASCIIfy the apostrophes, dashes, and the
connection.py space that started this thread. People's names, URLs,
and demonstrative characters I'm more inclined to leave. Agreed?


Agreed. Please open an issue.

Using non-ASCII apostrophes and like in docstrings may be considered a bug.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Chris Angelico
On Fri, Dec 18, 2015 at 6:12 PM, Serhiy Storchaka  wrote:
> Agreed. Please open an issue.
>
> Using non-ASCII apostrophes and like in docstrings may be considered a bug.

http://bugs.python.org/issue25899

Also noticed this. Is this a markup error?

Lib/urllib/request.py:190:
Note that *None& may be returned if no handler handles the request (though
the default installed global OpenerDirector uses UnknownHandler to ensure
this never happens).

It looks fine on the web:
https://docs.python.org/3/library/urllib.request.html

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should stdlib files contain 'narrow non breaking space' U+202F?

2015-12-17 Thread Chris Angelico
On Fri, Dec 18, 2015 at 6:12 PM, Serhiy Storchaka  wrote:
> Agreed. Please open an issue.
>
> Using non-ASCII apostrophes and like in docstrings may be considered a bug.

http://bugs.python.org/issue25899

Also noticed this. Is this a markup error?

Lib/urllib/request.py:190:
Note that *None& may be returned if no handler handles the request (though
the default installed global OpenerDirector uses UnknownHandler to ensure
this never happens).

It looks fine on the web:
https://docs.python.org/3/library/urllib.request.html

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list