[issue30167] site.main() does not work on Python 3.6 and superior if PYTHONSTARTUP is set

2018-06-10 Thread INADA Naoki


Change by INADA Naoki :


--
pull_requests: +7238
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33687] uu.py calls os.path.chmod which doesn't exist

2018-06-10 Thread Poul-Henning Kamp


Poul-Henning Kamp  added the comment:

I was just playing with it in a prototype and noticed that it didn't work.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33770] base64 throws 'incorrect padding' exception when the issue is NOT with the padding

2018-06-10 Thread Ned Deily


Change by Ned Deily :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 2.7, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33770] base64 throws 'incorrect padding' exception when the issue is NOT with the padding

2018-06-10 Thread Tal Einat


Tal Einat  added the comment:

The change is not entirely backward-compatible, so not back-porting before 3.7 
seems good to me. IMO this should be closed.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



NUL in file names verified [was Re: Why exception from os.path.exists()?]

2018-06-10 Thread Steven D'Aprano
Straight from the horse's mouth, Apple's HFS Plus volumes do indeed
support NULs in file names. Quote:


Indirect node files exist in a special directory called the
metadata directory. This directory exists in the volume's root
directory. The name of the metadata directory is four null
characters followed by the string "HFS+ Private Data".


and:

The case-insensitive Unicode string comparison used by
HFS Plus and case-insensitive HFSX sorts null characters
after all other characters, so the metadata directory
will typically be the last item in the root directory.
On case-sensitive HFSX volumes, null characters sort
before other characters, so the metadata directory will
typically be the first item in the root directory.


https://developer.apple.com/library/archive/technotes/tn/tn1150.html#HFSPlusNames




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


[issue33825] Change mentions of "magic" attributes to "special"

2018-06-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Both terms are in common use.  There is no need to elide the word "special".

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:

The 3.7 What's New has been updated as Nick suggested.  Thanks, Nick, and 
thanks, Ned, for bringing it up!

--
priority: deferred blocker -> 
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 14a190c88273fb22d9439bbed394f19f21e8a0f9 by Miss Islington (bot) 
in branch '3.7':
bpo-33745: Add What's New for empty function docstring change. (GH-7611)
https://github.com/python/cpython/commit/14a190c88273fb22d9439bbed394f19f21e8a0f9


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7237

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset 12c6cdf4d16078aa09de32a39193c8161177b39d by Ned Deily in branch 
'master':
bpo-33745: Add What's New for empty function docstring change. (GH-7611)
https://github.com/python/cpython/commit/12c6cdf4d16078aa09de32a39193c8161177b39d


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33745] 3.7.0b5 changes the line number of empty functions with docstrings

2018-06-10 Thread Ned Deily


Change by Ned Deily :


--
keywords: +patch
pull_requests: +7236
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset a73399d5963d6b1639d935968f4a8baa868c39d3 by Ned Deily (Miss 
Islington (bot)) in branch '3.7':
bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609) 
(GH-7610)
https://github.com/python/cpython/commit/a73399d5963d6b1639d935968f4a8baa868c39d3


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26510] [argparse] Add required argument to add_subparsers

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset a73399d5963d6b1639d935968f4a8baa868c39d3 by Ned Deily (Miss 
Islington (bot)) in branch '3.7':
bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609) 
(GH-7610)
https://github.com/python/cpython/commit/a73399d5963d6b1639d935968f4a8baa868c39d3


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7234

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26510] [argparse] Add required argument to add_subparsers

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7235

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26510] [argparse] Add required argument to add_subparsers

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset ef057bfb06cae0718e6d708061649d2e3983e2ef by Ned Deily in branch 
'master':
bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609)
https://github.com/python/cpython/commit/ef057bfb06cae0718e6d708061649d2e3983e2ef


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset ef057bfb06cae0718e6d708061649d2e3983e2ef by Ned Deily in branch 
'master':
bpo-33109: Remove now-obsolete What's New entry for bpo-26510. (GH-7609)
https://github.com/python/cpython/commit/ef057bfb06cae0718e6d708061649d2e3983e2ef


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

2018-06-10 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +7232

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26510] [argparse] Add required argument to add_subparsers

2018-06-10 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +7233

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33825] Change mentions of "magic" attributes to "special"

2018-06-10 Thread Andrés Delfino

New submission from Andrés Delfino :

PR makes all documentation use the same term.

--
assignee: docs@python
components: Documentation
messages: 319263
nosy: adelfino, docs@python
priority: normal
severity: normal
status: open
title: Change mentions of "magic" attributes to "special"
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33825] Change mentions of "magic" attributes to "special"

2018-06-10 Thread Andrés Delfino

Change by Andrés Delfino :


--
keywords: +patch
pull_requests: +7231
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30167] site.main() does not work on Python 3.6 and superior if PYTHONSTARTUP is set

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:

As I noted in the discussion on PR 6731, I think there should be a test for 
this so we don't break it again.  But, since it seems that the problem has 
affected a number of users and projects and since the fix is easy and easily 
testable manually, I decided to merge the PR for 3.7.0rc1 and 3.6.6rc1.  I am 
leaving the issue open for someone to supply a PR with a test case and for 
discussion of PR 7415.  Thank you all!

--
stage: patch review -> needs patch
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30167] site.main() does not work on Python 3.6 and superior if PYTHONSTARTUP is set

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset 3e121581d008a780b8a9f1bcda5966cf0c06f6d5 by Ned Deily (Miss 
Islington (bot)) in branch '3.6':
bpo-30167: Prevent site.main() exception if PYTHONSTARTUP is set. (GH-6731) 
(GH-7607)
https://github.com/python/cpython/commit/3e121581d008a780b8a9f1bcda5966cf0c06f6d5


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30167] site.main() does not work on Python 3.6 and superior if PYTHONSTARTUP is set

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset ec4343c3b4c0e0a7500122fac616e6488c0ab842 by Ned Deily (Miss 
Islington (bot)) in branch '3.7':
bpo-30167: Prevent site.main() exception if PYTHONSTARTUP is set. (GH-6731) 
(GH-7606)
https://github.com/python/cpython/commit/ec4343c3b4c0e0a7500122fac616e6488c0ab842


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33738] PyIndex_Check conflicts with PEP 384

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:

Sigh!  I was hoping we could get this in for 3.7.0 but I think we have run out 
of time and we really should not be making potential user-visible API changes 
at this last minute.  I did notice the new compile warning for the Windows 
non-debug build but I overlooked that some other non-Windows buildbots were 
getting them, too.  Serihy proposes a more general fix in Issue33818 but I 
don't think we should be making a change like that just prior to the release 
candidate.

And, in retrospect, I should not have considered trying to fix the stable ABI 
support at this late date, either. It looks like it has been broken for some 
time now so 3.7.0 will not be any worse.  At this point, we have Christian's 
two PRs in master now; if necessary, they could be reverted.  I will bow out of 
this discussion and let you all figure out what is best for master/3.8.  Once 
the changes for master are in and working, we could revisit the question of 
backports to 3.7 and/or 3.6 maintenance releases. I would like to both thank 
and apologize to Christian, in particular, and to Serhiy and everyone else who 
went out of their ways to try to get this in.

Lowering priority to "critical".

--
priority: release blocker -> critical
versions:  -Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why exception from os.path.exists()?

2018-06-10 Thread Chris Angelico
On Mon, Jun 11, 2018 at 11:06 AM, Steven D'Aprano
 wrote:
> On Sun, 10 Jun 2018 23:57:35 +0200, Peter J. Holzer wrote:
>
>> I think this is worth keeping, and "I couldn't pass that file name to
>> the OS" is a different error than "the OS told me the file doesn't
>> exist", so I think it should be a different exception.
>
> What makes you think that NUL bytes are a fundamental limitation that no
> OS could every cope with?

I didn't say that. If you have an OS that can't handle more than 255
bytes of file name, it's allowed to raise ValueError just the same.

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


Re: Why exception from os.path.exists()?

2018-06-10 Thread Steven D'Aprano
On Sun, 10 Jun 2018 23:57:35 +0200, Peter J. Holzer wrote:

> I think this is worth keeping, and "I couldn't pass that file name to
> the OS" is a different error than "the OS told me the file doesn't
> exist", so I think it should be a different exception.

What makes you think that NUL bytes are a fundamental limitation that no 
OS could every cope with?

Classic Mac OS takes file names as Pascal strings, with a length byte and 
an array of arbitrary bytes, no NUL terminator required. Despite what far 
too many C programmers appear to believe, NUL-terminated strings are not 
a fundamental requirement.

Navigating Apple's documentation is a nightmare, but I've found the 
deprecated Carbon file manager APIs. For example, creating a file with 
PBCreateFileUnicodeSync:

https://developer.apple.com/documentation/coreservices/1566896-
pbcreatefileunicodesync?language=objc

takes a FSRefParam argument:

https://developer.apple.com/documentation/coreservices/fsrefparam?
language=objc

which includes a name field which is a pointer to an array of Unicode 
characters, and a separate name length.

The evidence suggests that using the Carbon APIs, NUL is just another 
Unicode character. Whatever API replaces Carbon, it will have to deal 
with file names created under Carbon, and classic Mac, and so likely will 
support the same.

Baking a limitation of some file systems into the high-level interface is 
simply a *bad idea*. There is no good reason to treat file names 
containing NUL as special in the API (even if, for implementation 
reasons, it has to be treated specially in the implementation).

How would you feel if there were a whole lot of ignorant Pascal 
programmers arguing that it was fundamentally impossible for file names 
to exceed 255 characters, and therefore os.path.exists() out to raise 
ValueError when passed a file name of 256 characters?

"But it is impossible to pass a string of 256 characters to the OS" is no 
more foolish than "it is impossible to pass a string with an embedded NUL 
to the OS". Both are implementation details. Neither should be baked into 
the high-level language as a fundamental requirement.



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: Why exception from os.path.exists()?

2018-06-10 Thread Charles Hixson

On 06/07/2018 12:45 AM, Chris Angelico wrote:

On Thu, Jun 7, 2018 at 1:55 PM, Steven D'Aprano
 wrote:

On Tue, 05 Jun 2018 23:27:16 +1000, Chris Angelico wrote:


And an ASCIIZ string cannot contain a byte value of zero. The parallel
is exact.

Why should we, as Python programmers, care one whit about ASCIIZ strings?
They're not relevant. You might as well say that file names cannot
contain the character "π" because ASCIIZ strings don't support it.

No they don't, and yet nevertheless file names can and do contain
characters outside of the ASCIIZ range.

Under Linux, a file name contains bytes, most commonly representing
UTF-8 sequences. So... an ASCIIZ string *can* contain that character,
or at least a representation of it. Yet it cannot contain "\0".

ChrisA
This seems like an argument for allowing byte strings to be used as file 
names, not for altering text strings.  If file names are allowed to 
contain values that are illegal for text strings, then they shouldn't be 
necessarily considered as text strings.


The unicode group sets one set of rules, and their rules should apply in 
their area.  The Linux group sets another set of rules, and their rules 
should apply in their area.  Just because there is a large area of 
overlap doesn't mean that the two areas are congruent.  Byte strings are 
designed to handle any byte pattern, but text strings are designed to 
handle a subset of those patterns. Most byte strings are readable as 
text, but not all of them.

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


[issue30167] site.main() does not work on Python 3.6 and superior if PYTHONSTARTUP is set

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7230

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30167] site.main() does not work on Python 3.6 and superior if PYTHONSTARTUP is set

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7229

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30167] site.main() does not work on Python 3.6 and superior if PYTHONSTARTUP is set

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset 2487f30d5529948ace26559e274d7cac6abcd1a8 by Ned Deily (Steve 
Weber) in branch 'master':
bpo-30167: Prevent site.main() exception if PYTHONSTARTUP is set. (GH-6731)
https://github.com/python/cpython/commit/2487f30d5529948ace26559e274d7cac6abcd1a8


--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why exception from os.path.exists()?

2018-06-10 Thread Steven D'Aprano
On Sun, 10 Jun 2018 22:09:39 +0100, Barry Scott wrote:

> Singling out os.path.exists as a special case I do think is reasonable.
> All functions that take paths need to have a consistent response to data

The *mere existence* of os.path.exists means that there is not a 
consistent response to file names:

open(foo) raises an exception if foo doesn't exist;

os.path.exists(foo) returns False if foo doesn't exist.

There is no requirement that different functions do the same thing with 
the same bad input. The *whole point* of o.p.exists is to return False, 
not raise an exception.


> that is impossible to pass to the OS.

Even if it were true that file names cannot contain certain characters, 
and it is not, why is that a distinction that anyone gives a shit about?

I do not expect that there are more than a handful of use-cases for 
distinguishing "file names which cannot be passed to the OS" versus "any 
other illegal file name". And even that is generous.

Besides, it is certainly not true that there are no OSes that can deal 
with NULs in file names. Classic Mac OS can, as filenames there are 
represented as Pascal strings (a length byte followed by an array of 
arbitrary bytes), not NUL-terminated C strings.




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: Why exception from os.path.exists()?

2018-06-10 Thread Bev in TX
I accidentally did not send this to the list...

> On Jun 10, 2018, at 7:10 PM, Bev in TX  wrote:
> 
> 
>> On Jun 10, 2018, at 3:10 PM, Chris Angelico > > wrote:
>>> ...
>> 
>> Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
>> I'd like to see what their file names are represented as.
>> 
> I dug around and found this very old article, in which it says:
> 
> "Another obvious problem is the different path separators between HFS+ 
> (colon, ':') and UFS (slash, '/'). This also means that HFS+ file names may 
> contain the slash character and not colons, while the opposite is true for 
> UFS file names. This was easy to address, though it involves transforming 
> strings back and forth. The HFS+ implementation in the kernel's VFS layer 
> converts colon to slash and vice versa when reading from and writing to the 
> on-disk format. So on disk the separator is a colon, but at the VFS layer 
> (and therefore anything above it and the kernel, such as libc) it's a slash. 
> However, the traditional Mac OS toolkits expect colons, so above the BSD 
> layer, the core Carbon toolkit does yet another translation. The result is 
> that Carbon applications see colons, and everyone else sees slashes. This can 
> create a user-visible schizophrenia in the rare cases of file names 
> containing colon characters, which appear to Carbon applications as slash 
> characters, but to BSD programs and Cocoa applications as colons.”
> 
> That was from, "USENIX 2000 Invited Talks Presentation” at:
> http://www.wsanchez.net/papers/USENIX_2000/ 
> 
> 
> 

Bev in TX




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


[issue33462] reversible dict

2018-06-10 Thread INADA Naoki


INADA Naoki  added the comment:

My patch was quick and dirty.
Please read _collections_abc module and follow the style. (you need to use
temporary variables.)
And new reviter types can be registered to Iterator ABC too.
-- 
INADA Naoki  

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why exception from os.path.exists()?

2018-06-10 Thread Chris Angelico
On Mon, Jun 11, 2018 at 9:52 AM, Steven D'Aprano
 wrote:
> On Mon, 11 Jun 2018 06:10:26 +1000, Chris Angelico wrote:
>
>> Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
>> I'd like to see what their file names are represented as.
>
> The Finder could very easily be substituting another character, like
> Konqueror (the KDE 3 file manager) does. In Konqueror, you can create a
> file named "spam/ham" and it quietly substitutes "spam%2fham" instead.
> But Konqueror's GUI treats it completely transparently: it is displayed
> as a slash, and if you copy the file name from the GUI you get a slash.

Speculation is all very well, but I was wanting to see what actually
happened. :)

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


Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Steven D'Aprano
On Mon, 11 Jun 2018 06:21:31 +1000, Chris Angelico wrote:
[...]
> Nice work there. You trimmed key parts of my post, and then responded to
> me out of context. Go back and read my actual post, then respond to what
> I actually said. Thanks!

I didn't trim any part of your post when I read it, but I took away the 
same message as Greg. Perhaps your point was not as clear as you thought 
it was.




-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-06-10 Thread bellcanadardp
On Sunday, 10 June 2018 17:29:59 UTC-4, Cameron Simpson  wrote:
> On 10Jun2018 13:04, bellcanada...@gmail.com  wrote:
> >here is the full error once again
> >to summarize, my script works fine in python2
> >i get this error trying to run it in python3
> >plz see below after the error, my settings for python 2 and python 3
> >for me it seems i need to change some settings to 'utf-8'..either just in 
> >python 3, since thats where i am having issues or change the settings to 
> >'utf-8' both in python 2 and 3i would appreciate feedback b4 i do some 
> >trial and error
> >thanks for the consideration
> >tommy
> >
> >***
> >Traceback (most recent call last):
> >File "createIndex.py", line 132, in 
> >c.createindex()
> >File "creatIndex.py", line 102, in createIndex
> >pagedict=self.parseCollection()
> >File "createIndex.py", line 47, in parseCollection
> >for line in self.collFile:
> >File 
> >"C:\Users\Robert\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py",
> > 
> >line 23, in decode
> >return codecs.charmap_decode(input,self.errors,decoding_table[0]
> >UnicodeDecodeError: 'charmap'codec can't decode byte 0x9d in position 7414: 
> >character maps to 
> 
> Ok, this is more helpful. It says that the decoding error, which occurred in 
> ...\cp1252.py, was decoding lines from the file self.collFile.
> 
> What is that file? And how was it opened?
> 
> Also, your settings below may indeed be important.
> 
> >***
> >python 3 settings
> >import sys
> > import locale
> >locale.getpreferredencoding()
> >'cp1252'
> 
> The setting above is the default encoding used when you open a file in text 
> mode in Python 3, but you can override it.
> 
> In Python 3 this matters a lot, because Python 3 strings are Unicode. In 
> Python 
> 2, strings are just bytes, and are not "decoded" (there is a whole separate 
> "unicode" type for that when it matters).
> 
> So in Python 3 the text file reader is decoding the text in the file 
> according 
> to what it expects the encoding to be.
> 
> Find the place where self.collFile is opened. You can specify the decoding 
> method there by adding the "encoding=" parameter to the open() call. It is 
> defaulting to "cp1252" because that is what locale.getpreferredencoding() 
> returns, but presumably the actual file data are not encoded that way.
> 
> You can (a) find out what encoding _is_ used in the file and specify that or 
> (b) tell Python to be less picky. Choice (a) is better if it is feasible.
> 
> If you have to guess because you don't know the encoding, one possibility is 
> that collFile contains utf-8 or utf-16; of these 2, utf-8 seems more likely 
> given the 0x9d byte causing the trouble.  Try adding:
> 
>   encoding='utf-8'
> 
> to the open() call, eg:
> 
>   self.collFile = open('path-to-the-coll-file', encoding='utf-8')
> 
> at the appropriate place.
> 
> If that just produces a different decoding error, you have 2 choices: pick an 
> encoding where every byte is "valid", such as 'iso8859-1', or to tell the 
> decode to just cope with th errors by adding the errors="replace" or 
> "errors="ignore" or errors="namereplace" parameter to the open() call.
> 
> Both these choices have downsides.
> 
> There are several ISO8859 encodings, and they might all be wrong for your 
> file, 
> leading to _incorrect_ text lines.
> 
> The errors="..." parameter also has downsides: you will also end up with 
> missing (errors="ignore") or incorrect (errors="replace" or 
> errors="namereplace") text, because the decoder has to do something with the 
> data: drop it or replace it with something wrong. The former loses data while 
> the latter puts in bad data, but at least it is visible if you inspect the 
> data 
> later.
> 
> The full documentation for Python 3's open() call is here:
> 
>   https://docs.python.org/3/library/functions.html#open
> 
> where the various encoding= and errors= choices are described.
> 
> Cheers,
> Cameron Simpson 

thank you for the reply
let me try these tips and suggestions and i will update here
thanxz alot
and thnxz also to all who post ..i appreciate it..
regards
tommy
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why exception from os.path.exists()?

2018-06-10 Thread Steven D'Aprano
On Mon, 11 Jun 2018 06:10:26 +1000, Chris Angelico wrote:

> Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
> I'd like to see what their file names are represented as.

The Finder could very easily be substituting another character, like 
Konqueror (the KDE 3 file manager) does. In Konqueror, you can create a 
file named "spam/ham" and it quietly substitutes "spam%2fham" instead. 
But Konqueror's GUI treats it completely transparently: it is displayed 
as a slash, and if you copy the file name from the GUI you get a slash.

I seem to recall Gnome doing something similar, except it quietly 
substitutes U+2044 FRACTION SLASH or U+2215 DIVISION SLASH instead.

To really be sure what is going on, you would have to bypass the Finder 
and any shell and write the file name using the OS X low-level API.

Or create the file using a classic Mac (system 8 or older), where slashes 
definitely are not treated as special. Not the Mac OS classic emulation 
layer.


Hmmm... you know I might just be able to do that. Write a file to a 
floppy, then mount it under Linux. If I had a Linux computer with a 
floppy disk drive.

(The march of technology is sometimes a nuisance.)

By the way, for some reason I don't seem to have received Bev's post.


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


Re: FULLSCREEN and DOUBLEBUF

2018-06-10 Thread Gregory Ewing

Dennis Lee Bieber wrote:

Both may be dependent upon the actual hardware graphics board and the
drivers for said board.


My guess is that if your surface is not fullscreen or is not
a hardware surface, then you're always drawing into an ofscreen
buffer that gets copied to the screen when display.flip() is
called. In other words, it's effectively double-buffered
whether you request it or not.

The only time it's an issue is when you're drawing directly
to the screen memory, i.e. both FULLSCREEN and HWSURFACE
where your hardware and drivers support that.

My suggestion is to just always specify DOUBLEBUF and not
worry about what's going on behind the scenes. That will
almost always give the result you want, i.e. a flicker-free
display.

The only time it would be an issue is if you wanted your
surface to *not* be double-buffered for some reason, but
that would be a rare situation.

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


Re: Sorting NaNs

2018-06-10 Thread Steven D'Aprano
On Sun, 10 Jun 2018 21:28:02 +0200, Anders Munch wrote:

> Richard Damon wrote:
> 
>> The two behaviors that I have heard suggested are:
>>
>> 1) If any of the inputs are a NaN, the median should be a NaN.
>> (Propagating the NaN as indicator of a numeric error)
>>
>> 2) Remove the NaNs from the input set and process what is left. If
>> nothing, then return a NaN (treating NaN as a 'No Data' placeholder).
> 
> 3) Raise an exception.
> 
> I can't believe anyone even suggested 2).  "In the face of ambiguity,
> refuse the temptation to guess."

It is not a guess if the user explicitly specifies that as the behaviour.

It would be no more of a guess than if the user called

data = [x for x in data if not math.isnan(x)]

on their data first.



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

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


[issue22454] Adding the opposite function of shlex.split()

2018-06-10 Thread bbayles


Change by bbayles :


--
nosy: +bbayles

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22454] Adding the opposite function of shlex.split()

2018-06-10 Thread bbayles


Change by bbayles :


--
keywords: +patch
pull_requests: +7228
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33738] PyIndex_Check conflicts with PEP 384

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset 8398713cea0eb17b013f25f86bef47c7e5e63139 by Ned Deily (Christian 
Tismer) in branch 'master':
bpo-33738: Address review comments in GH #7477 (GH-7585)
https://github.com/python/cpython/commit/8398713cea0eb17b013f25f86bef47c7e5e63139


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: your mail

2018-06-10 Thread Bob Gailer
On Jun 10, 2018 12:44 PM, "Karsten Hilbert"  wrote:
>
> On Sun, Jun 10, 2018 at 06:58:17PM +0530, sagar daya wrote:
>
> > Couldn't install any module from pip
> > Plz help???

The only help I can give at this point is to suggest that you tell us what
you tried and how it failed. Please copy and paste any relevant terminal
entries and error messages. No screenshots no attempts to rephrase just the
facts. Once we have those we can take the next step. Just out of curiosity
did you think there could be any other answer to your question? In the
future please think about what you're asking otherwise it cost us time to
have to ask you for the information we need got
>
> https://duckduckgo.com
>
> kh
> --
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Multiprocessing on a remote host

2018-06-10 Thread Peter J. Holzer
On 2018-03-21 09:27:37 -0400, Larry Martell wrote:
> Yeah, I saw that and I wasn't trying to reinvent the wheel. On this
> page https://docs.python.org/2/library/multiprocessing.html it says
> this:
> 
> The multiprocessing package offers both local and remote concurrency,
> effectively side-stepping the Global Interpreter Lock by using
> subprocesses instead of threads. Due to this, the multiprocessing
> module allows the programmer to fully leverage multiple processors on
> a given machine.
> 
> I took 'remote concurrency' to mean I could use it run a process on
> another host.

Yes.

> But I don't see how to do that, and I was asking if it was possible or
> am I misinterpreting the docs.

It is described on the same page, a little bit farther down:
https://docs.python.org/2/library/multiprocessing.html#using-a-remote-manager

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33738] PyIndex_Check conflicts with PEP 384

2018-06-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +7227

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Peter J. Holzer
On 2018-06-11 06:35:27 +1000, Chris Angelico wrote:
> Back in the 90s, my family sold books, many of them imported and/or
> exported. We had a few books by Earl Rodd, all looking like books and
> behaving like books. And we also had the "Rodd Papers", which are
> individual photocopied leaflets (A5, maybe 20-32 pages tops). They're
> also copyrightable, right? Well here's the thing. One of the books was
> simply a published compilation of a large number of the papers. So
> what is the "work"? Is the book a brand-new work? If you cease to
> register the papers and start registering the book (one work, not
> dozens, and also a new work so the stupid exponentiation resets),
> people can't copy the papers either, because they're entirely
> contained within the book.

But they can, because each of the papers is now public domain.

This situation also exists with current copyright law. If a book is out
of copyright (either because the author has been dead for 70 years or
because it fell through one of the gaps of the various copyright law
changes in the US), you can re-publish it. Now you do have the copyright
for the new book, but that stops others only from copying your book, not
the original.


> So... all you have to do is, every couple of years, gather everything
> you've ever written into a brand new book and register it.

That would be stupid. Fortunately the solution is obvious.


> >> >  * Every worthwhile creation is worth $1,000 for ten years.
> >>
> >> Not true by a long shot, and if you don't believe me, you can pay me
> >> $1000 right now for ten years' use of any of my free software.
> >
> > I think he meant it the other way around: If you can sell your software
> > for 10 years, you can affort $1000 to have your monopoly protected.
> 
> Except that I'm not selling it. What if I want to give it away, but
> with the proviso that the document credits me properly? "Go ahead, use
> it, publish it, but keep my name on it" is a common thing for people
> to request. And it's toothless [1] without copyright; so if you have
> to pay money for the right to be credited,

Depends on the details of the law. For example, in most of Europe there
is a difference between the "Urheberrecht" (creator's rights) and the
"Verwertungsrecht" (exploitation rights) (there are no exact equivalent
in English, so I'm using the German words). The former is always bound
to the person who created the work and cannot be sold. The latter can
(and usually is). The right of a person to be credited could be part of
the former. There is also much less incentive to pretend you wrote
something you didn't if there is no financial advantage, so it may not
be that important.

> there's going to be a lot of corporate bullying.

I don't really see why there would be more than now.

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33818] Make PyExceptionClass_Name returning a const string

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:

While I think the change makes sense aesthetically, I do not see a compelling 
reason why such a user interface change should be introduced to 3.7 at 
literally the last moment.  Let's do it for 3.8, please.

--
versions:  -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Change by Alexander Belopolsky :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 1d4089b5d208ae6f0bd256304fd77f04c0b4fd41 by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.6':
bpo-33812: Corrected astimezone for naive datetimes. (GH-7578) (GH-7601)
https://github.com/python/cpython/commit/1d4089b5d208ae6f0bd256304fd77f04c0b4fd41


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 037e9125527d4a55af566f161c96a61b3c3fd998 by Alexander Belopolsky 
(Miss Islington (bot)) in branch '3.7':
bpo-33812: Corrected astimezone for naive datetimes. (GH-7578) (GH-7600)
https://github.com/python/cpython/commit/037e9125527d4a55af566f161c96a61b3c3fd998


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why exception from os.path.exists()?

2018-06-10 Thread Peter J. Holzer
On 2018-06-11 00:28:11 +0300, Marko Rauhamaa wrote:
> Barry Scott :
> > Singling out os.path.exists as a special case I do think is
> > reasonable.
> 
> I don't think anyone has proposed that. While I brought up
> os.path.exists() in my bug report, os.path.isfile(), os.path.isdir() etc
> should obviously be addressed simultaneously.

Yes.

> It may even be that the fix needs to go to os.stat(). That's for the
> Python gods to decide.

I'm not a Python god, but I don't think os.stat() should be changed.
That already throws different exceptions for different errors:

>>> os.stat("nix")
Traceback (most recent call last):
  File "", line 1, in 
FileNotFoundError: [Errno 2] No such file or directory: 'nix'
>>> os.stat("/lost+found/foo")
Traceback (most recent call last):
  File "", line 1, in 
PermissionError: [Errno 13] Permission denied: '/lost+found/foo'
>>> os.stat("\0")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: embedded null byte

I think this is worth keeping, and "I couldn't pass that file name to
the OS" is a different error than "the OS told me the file doesn't
exist", so I think it should be a different exception.

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33748] test_discovery_failed_discovery in test_unittest modifies sys.path

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:

Backported for 3.7.0rc1 and 3.6.6rc1.  Thanks, all!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33748] test_discovery_failed_discovery in test_unittest modifies sys.path

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset 040d4a7b5899b9635c6997c5ecb91f8299f0b352 by Ned Deily (Miss 
Islington (bot)) in branch '3.6':
bpo-33748: fix tests altering sys.path and sys.modules (GH-7433) (GH-7603)
https://github.com/python/cpython/commit/040d4a7b5899b9635c6997c5ecb91f8299f0b352


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33748] test_discovery_failed_discovery in test_unittest modifies sys.path

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset 298eb07faa66da9c588bd82db14a6eef64167ede by Ned Deily (Miss 
Islington (bot)) in branch '3.7':
bpo-33748: fix tests altering sys.path and sys.modules (GH-7433) (#7604)
https://github.com/python/cpython/commit/298eb07faa66da9c588bd82db14a6eef64167ede


--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33770] base64 throws 'incorrect padding' exception when the issue is NOT with the padding

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:

I backported Tal's fix for 3.7.0rc1.  I am less certain about backporting to 
3.6 and 2.7 at this stage of their lives but I don't have a strong feeling 
about it so I'll leave the issue open for that.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33770] base64 throws 'incorrect padding' exception when the issue is NOT with the padding

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:


New changeset 053d6c5ce246e6ba9c046467b02a0b6ba4abb8bf by Ned Deily (Miss 
Islington (bot)) in branch '3.7':
bpo-33770: improve base64 exception message for encoded inputs of invalid 
length (GH-7416) (GH-7602)
https://github.com/python/cpython/commit/053d6c5ce246e6ba9c046467b02a0b6ba4abb8bf


--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Posting warning message

2018-06-10 Thread Cameron Simpson

On 10Jun2018 11:26, John Ladasky  wrote:

On Sunday, June 10, 2018 at 7:47:01 AM UTC-7, T Berger wrote:

When I go to post a reply, I get a warning asking if I want my email address 
(or other email addresses listed) visible to all, and do I want to edit my 
post. What should I do?


Are you posting through Google Groups?  Sometimes I see that warning as well.
Some, but not all, Usenet software deliberately mangles email addresses when 
composing posts.


Ah, interesting.

It's a good thing to mangle email addresses when posting publicly, as it makes 
it harder for spammers to find new targets.  So answer "yes", and manually 
edit any email addresses you see in the post so that they can't be recovered.  


"Good" is subjective. I don't think it is a good thing, but many people do.

My reasoning is that I'm never going to successfully hide my email address, so 
usually I won't bother. If I need to post somewhere I'd like private, I can 
always invent a random address like:


 c2d56bb1edc5a...@mailinator.com

for that special purpose and move on.

GMail has good spam filtering tech on the whole, so its users should be 
relatively comfortable about spam.


So when I post to a public forum I usually use my normal email address.

This is a personal decision and anyone might choose differently.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Chris Angelico
On Mon, Jun 11, 2018 at 12:25 AM, Peter J. Holzer  wrote:
> But with online distribution (not necessarily github) the boundaries
> become very fluid. When Debian still contained the Roxen webserver, it
> comprised over 100 packages: The maintainer had put every plugin into a
> separate package. I did something similar with my qpsmtpd plugins: Each
> is in a separate .deb or .rpm file.

Python has long been distributed as a single .msi file on Windows, but
as many separate .deb packages on Debian Linux. One work or many?

Back in the 90s, my family sold books, many of them imported and/or
exported. We had a few books by Earl Rodd, all looking like books and
behaving like books. And we also had the "Rodd Papers", which are
individual photocopied leaflets (A5, maybe 20-32 pages tops). They're
also copyrightable, right? Well here's the thing. One of the books was
simply a published compilation of a large number of the papers. So
what is the "work"? Is the book a brand-new work? If you cease to
register the papers and start registering the book (one work, not
dozens, and also a new work so the stupid exponentiation resets),
people can't copy the papers either, because they're entirely
contained within the book.

So... all you have to do is, every couple of years, gather everything
you've ever written into a brand new book and register it.

>> >  * Every worthwhile creation is worth $1,000 for ten years.
>>
>> Not true by a long shot, and if you don't believe me, you can pay me
>> $1000 right now for ten years' use of any of my free software.
>
> I think he meant it the other way around: If you can sell your software
> for 10 years, you can affort $1000 to have your monopoly protected.

Except that I'm not selling it. What if I want to give it away, but
with the proviso that the document credits me properly? "Go ahead, use
it, publish it, but keep my name on it" is a common thing for people
to request. And it's toothless [1] without copyright; so if you have
to pay money for the right to be credited, there's going to be a lot
of corporate bullying.

ChrisA

[1] No, it's not a dragon. I can't imagine why you would think that.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why exception from os.path.exists()?

2018-06-10 Thread Marko Rauhamaa
Barry Scott :
> Singling out os.path.exists as a special case I do think is
> reasonable.

I don't think anyone has proposed that. While I brought up
os.path.exists() in my bug report, os.path.isfile(), os.path.isdir() etc
should obviously be addressed simultaneously. It may even be that the
fix needs to go to os.stat(). That's for the Python gods to decide.

> All functions that take paths need to have a consistent response to
> data that is impossible to pass to the OS.

Possibly.


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


Re: Posting warning message

2018-06-10 Thread Chris Angelico
On Mon, Jun 11, 2018 at 4:26 AM, John Ladasky
 wrote:
> On Sunday, June 10, 2018 at 7:47:01 AM UTC-7, T Berger wrote:
>> When I go to post a reply, I get a warning asking if I want my email address 
>> (or other email addresses listed) visible to all, and do I want to edit my 
>> post. What should I do?
>
> Are you posting through Google Groups?  Sometimes I see that warning as well.
>
> Some, but not all, Usenet software deliberately mangles email addresses when 
> composing posts.  It's a good thing to mangle email addresses when posting 
> publicly, as it makes it harder for spammers to find new targets.  So answer 
> "yes", and manually edit any email addresses you see in the post so that they 
> can't be recovered.  For example, if my email address was posted undisguised, 
> you could edit it to "j...@g...com" and that should do the trick.
>

Or just use the mailing list and do things honestly. Much easier AND
safer than using Google Groups.

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


Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-06-10 Thread Cameron Simpson

On 10Jun2018 13:04, bellcanada...@gmail.com  wrote:

here is the full error once again
to summarize, my script works fine in python2
i get this error trying to run it in python3
plz see below after the error, my settings for python 2 and python 3
for me it seems i need to change some settings to 'utf-8'..either just in 
python 3, since thats where i am having issues or change the settings to 
'utf-8' both in python 2 and 3i would appreciate feedback b4 i do some 
trial and error
thanks for the consideration
tommy

***
Traceback (most recent call last):
File "createIndex.py", line 132, in 
c.createindex()
File "creatIndex.py", line 102, in createIndex
pagedict=self.parseCollection()
File "createIndex.py", line 47, in parseCollection
for line in self.collFile:
File 
"C:\Users\Robert\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py", 
line 23, in decode

return codecs.charmap_decode(input,self.errors,decoding_table[0]
UnicodeDecodeError: 'charmap'codec can't decode byte 0x9d in position 7414: character 
maps to 


Ok, this is more helpful. It says that the decoding error, which occurred in 
...\cp1252.py, was decoding lines from the file self.collFile.


What is that file? And how was it opened?

Also, your settings below may indeed be important.


***
python 3 settings
import sys
import locale
locale.getpreferredencoding()
'cp1252'


The setting above is the default encoding used when you open a file in text 
mode in Python 3, but you can override it.


In Python 3 this matters a lot, because Python 3 strings are Unicode. In Python 
2, strings are just bytes, and are not "decoded" (there is a whole separate 
"unicode" type for that when it matters).


So in Python 3 the text file reader is decoding the text in the file according 
to what it expects the encoding to be.


Find the place where self.collFile is opened. You can specify the decoding 
method there by adding the "encoding=" parameter to the open() call. It is 
defaulting to "cp1252" because that is what locale.getpreferredencoding() 
returns, but presumably the actual file data are not encoded that way.


You can (a) find out what encoding _is_ used in the file and specify that or 
(b) tell Python to be less picky. Choice (a) is better if it is feasible.


If you have to guess because you don't know the encoding, one possibility is 
that collFile contains utf-8 or utf-16; of these 2, utf-8 seems more likely 
given the 0x9d byte causing the trouble.  Try adding:


 encoding='utf-8'

to the open() call, eg:

 self.collFile = open('path-to-the-coll-file', encoding='utf-8')

at the appropriate place.

If that just produces a different decoding error, you have 2 choices: pick an 
encoding where every byte is "valid", such as 'iso8859-1', or to tell the 
decode to just cope with th errors by adding the errors="replace" or 
"errors="ignore" or errors="namereplace" parameter to the open() call.


Both these choices have downsides.

There are several ISO8859 encodings, and they might all be wrong for your file, 
leading to _incorrect_ text lines.


The errors="..." parameter also has downsides: you will also end up with 
missing (errors="ignore") or incorrect (errors="replace" or 
errors="namereplace") text, because the decoder has to do something with the 
data: drop it or replace it with something wrong. The former loses data while 
the latter puts in bad data, but at least it is visible if you inspect the data 
later.


The full documentation for Python 3's open() call is here:

 https://docs.python.org/3/library/functions.html#open

where the various encoding= and errors= choices are described.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


[issue33748] test_discovery_failed_discovery in test_unittest modifies sys.path

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7226

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33770] base64 throws 'incorrect padding' exception when the issue is NOT with the padding

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7224

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33748] test_discovery_failed_discovery in test_unittest modifies sys.path

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7225

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why exception from os.path.exists()?

2018-06-10 Thread Barry Scott

> On 10 Jun 2018, at 21:10, Chris Angelico  wrote:
> 
> On Mon, Jun 11, 2018 at 12:45 AM, Bev in TX  wrote:
>>> * One with an embedded / in the file name
>> 
>> This is easily done in Finder, where I created a folder named "my/slash”.
>> When I list it at the command line in Terminal, this shows up as "my:slash”, 
>> with the slash shown as a colon.
>> If I create a file with a colon in its name at the command line, that file 
>> name acts the same way:
>> 
>> $ touch ‘my:colon"
>> $ ls
>> my:colon
>> my:slash
>> 
>> In Finder they both display as:
>> my/colon
>> my/slash
>> 
>> However, if you use Finder’s “Copy item as Pathname” option, then you will 
>> again see the colon.
>> 
>> /Users/bev/Training/myPython/pygroup/files/my:colon
>> /Users/bev/Training/myPython/pygroup/files/my:slash
>> 
>> But if you paste that folder’s name in Finder’s “Go to Folder” option, it 
>> converts it to the following, and goes to that folder:
>> 
>> /Users/bev/Training/myPython/pygroup/files/my/slash/slash
> 
> Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
> I'd like to see what their file names are represented as.

On Classic Mac OS the folder separator was : not /. /usr/bin/ls would be 
usr:bin:ls for example.

It looks like a hang over from Classic that the macOS Finder maps between : to 
/ for presentation.
In bash you see the ":" in Finder you see a /.

In the Finder attempting to use a : in a filename gets an error message "Name 
cannot be uses a:b".
In macOS bash you cannot use a / in a filename.

I think what all boils down to this:

Windows, macOS and Linux etc all use a 0 as the end of string marker. (Windows 
uses 16bit 0 not 8bit 0).
The os file functions call the underlying OS and map its results into successes 
or exceptions.

The \0 means that the OS functions cannot be passed the data from the user.
Therefore you cannot get an error code from the OS.

All the other file systems rules are checked by the OS itself and any errors 
are reported to the user as OSError etc.

For example on windows the OS will prevent use '<' in a filename and it is the 
OS that returned the error.

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> open('a", line 1, in 
OSError: [Errno 22] Invalid argument: 'a>> open('a\0b', 'w')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: embedded null character
>>>

Singling out os.path.exists as a special case I do think is reasonable.
All functions that take paths need to have a consistent response to data that 
is impossible to pass to the OS.

When it is impossible to get the OS to see all of the users data I'm not sure 
what else is reasonable for python
to do then what it already does not NUL.

With the exception that I do not think this is documented and the docs should 
be fixed.

Barry

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


[issue13153] IDLE 3.x on Windows crashes when pasting non-BMP unicode

2018-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

AFAIK, the big new feature of tcl/tk 9.0 is intended to be full unicode 
support.  We can hope that 9.0 appears in time to be included in the 3.8 
installers.

Until then, I think filenames, user program output, and clipboard content 
should be checked for the presence of astral characters before being sent to a 
tk widget. For this issue, that means replacing the built-in <> handler. 
 Replace astral chars with \U000 escapes.  If the widget it a Text, tag the 
escape as 'Astral' and color it with the code context colors to distinguish it 
from escapes originally in the string.

Strings know their kind, but a request to expose that has been rejected.  
Pyshell currently compares the max codepoint to ''.  But it appears that we 
can detect kind with an O(1) expression.  For 3.6 and 3.7, "sys.getsizeof(s) == 
76 + len(s)".  For 3.8, "sys.getsizeof(s) == 48 + len(s)".  Does anyone know 
why the difference?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Peter J. Holzer
On 2018-06-10 15:24:38 +, Steven D'Aprano wrote:
> On Sun, 10 Jun 2018 16:25:24 +0200, Peter J. Holzer wrote:
> > Personally, I would let the author decide what constitutes one work.
> 
> Ah yes...
> 
> Star Wars, Empire Strikes Back, Return of the Jedi, Phantom Menace, 
> Attack of the Clones, Revenge of the Sith, Rogue One, Force Awakens, Last 
> Jedi, Solo... they're all chapters in one work, yes?

Yes, that would be possible. But there were 40+ years between the
release of Star Wars and the release of Solo, so if George Lucas had
decided to wait until the series is complete before registering it for
copyright, he either couldn't have published it yet (Episode IX is
scheduled for next year) or he would have published the parts without
protection (effectively making them public domain).

So Lucas would have registered Star Wars in 1977, and when the Empire
Strikes Back came out in 1980, he would have had the option to register
it as a separate work or to register the series consisting of both
films. Wouldn't have made a difference since he would have had to
continue to pay for Star Wars to prevent it from falling into the public
domain.

At some point he probably would have decided that continued copyright
protection wasn't worth the cost, so the first three episodes would be
public domain by now (If the doubling period is only one year. The
article I read suggested different doubling periods for different kind
of works: 1 year for patents, 3 years for books, ... It also depends on
the initial fee: Start at $1 (a token amount), $100 (may cover the cost
of having a person actually looking at it), $1000, ...?)

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Jon Ribbens
On 2018-06-10, Ben Bacarisse  wrote:
> Jon Ribbens  writes:
>
>> I'd suggest that since the processes he's purporting to disallow are
>> entirely standard and automated and he knows full well they exist and
>> that there is no mechanism by which they could be affected by his
>> notice, the notice has little effect.
>
> The Copyright notice is probably intended for human eyes.  IIRC his
> posts don't show up on Google groups, for example, so there *is* a
> mechanism by which *some* of the headers (it may be X-no-archive) do get
> acted on.

True - many Usenet headers are intended for automated processing - but
the meaning of X-No-Archive is not even slightly similar to what he
says in his copyright notice, and so any overlap between the effect of
the former and the intention of the latter is merely coincidental.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7223

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33462] reversible dict

2018-06-10 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi INADA thanks for the benchmark, I did both of them too and got the same 
results (though I had to apply https://github.com/python/performance/pull/41 to 
get the performance module working).

Should I apply your patch in PR 6827?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7222
stage: commit review -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky


Alexander Belopolsky  added the comment:


New changeset 877b23202b7e7d4f57b58504fd0eb886e8c0b377 by Alexander Belopolsky 
in branch 'master':
bpo-33812: Corrected astimezone for naive datetimes. (GH-7578)
https://github.com/python/cpython/commit/877b23202b7e7d4f57b58504fd0eb886e8c0b377


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32493] UUID Module - FreeBSD build failure

2018-06-10 Thread Michael Felt


Michael Felt  added the comment:

I was not aware that _uuid was new to python3-3.7. I thought it had been around 
for a long time. 

Bpo-28009 goes back two years and i was unaware of uuid_create(). 

Would it be easier to split it into 3 issues? One for unixdll, one for netstat, 
and one for test_uuid?

Michael

Sent from my iPhone

> On 10 Jun 2018, at 13:52, STINNER Victor  wrote:
> 
> 
> STINNER Victor  added the comment:
> 
>> As noted on PR 7511 and PR 7567, I have merged Michael's configure.ac fixes 
>> for testing for uuid_enc_be availability (independent of platform) that were 
>> incorrect in earlier commits for this issue.  Merged for 3.7.0rc1 and master 
>> (3.8). Thanks, everyone!
> 
> Thanks you Ned and Michael. Sorry for the confusion. I was first confused 
> that the fix for master added a lot of code using ctypes. The final fix is 
> the right fix for 3.7 and master ;-)
> 
> Michael: if you want to fix uuid on 3.6, I would suggest to open a new issue, 
> because it seems that the fix is much more complex and unrelated to _uuid 
> (module added to Python 3.7).
> 
> --
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why exception from os.path.exists()?

2018-06-10 Thread Peter J. Holzer
On 2018-06-10 09:45:06 -0500, Bev in TX wrote:
> On Jun 10, 2018, at 5:49 AM, Peter J. Holzer  wrote:
> > On 2018-06-07 12:47:15 +, Steven D'Aprano wrote:
> >> But it doesn't do that. "Pathnames cannot contain NUL" is a falsehood 
> >> that programmers wrongly believe about paths. HFS Plus and Apple File 
> >> System support NULs in paths.
> > [...]
> >> But in the spirit of compromise, okay, let's ignore the existence of file 
> >> systems like HFS which allow NUL. Apart from Mac users, who uses them 
> >> anyway? Let's pretend that every file system in existence, now and into 
> >> the future, will prohibit NULs in paths.
[...]
> >  * One with an embedded / in the file name
> 
> This is easily done in Finder, where I created a folder named "my/slash”.  
> When I list it at the command line in Terminal, this shows up as "my:slash”, 
> with the slash shown as a colon.  
> If I create a file with a colon in its name at the command line, that file 
> name acts the same way:
> 
> $ touch ‘my:colon"
> $ ls
> my:colon
> my:slash
> 
> In Finder they both display as:
> my/colon
> my/slash

Thanks. So they just map '/' to ':'. IIRC, MacOS <= 9 used ':' as the
directory separator, so that makes sense. They kept the old behaviour
for applications using the Mac API (and for the GUI), but for the POSIX
API they use '/' (as they have to). Since ':' wasn't previously allowed,
there is no conflict, just some confusion for the users who sees
different filenames depending on which tool they use.

It does, however, mean that on MacOS filenames can't contain all Unicode
characters, either.

[...]
> I added printing the file name.  As suspected, the “slash” is a colon:
> 
> . - 56096374 - 2e
> .. - 56095464 - 2e 2e
> .DS_Store - 56109197 - 2e 44 53 5f 53 74 6f 72 65
> my:colon - 56095933 - 6d 79 3a 63 6f 6c 6f 6e
> my:slash - 56095521 - 6d 79 3a 73 6c 61 73 68

Yup.


> > Bonuspoints for doing this on an USB stick and then mounting the USB
> > stick on a Linux system and posting the output there as well.
> > 
> Sorry, I don’t have Linux, but I suspect it’s the same as the macOS command 
> line.

Very likely, yes.

hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why exception from os.path.exists()?

2018-06-10 Thread Chris Angelico
On Mon, Jun 11, 2018 at 6:22 AM, Marko Rauhamaa  wrote:
> Chris Angelico :
>> Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
>> I'd like to see what their file names are represented as.
>
> I think Bev already explained it. At Unix level, you can't have slashes
> in filenames. At GUI level, you can't have colons in filenames. Unix
> slashes are bijectively mapped to colons in the GUI.
>
> So what you are asking can't really be tried out.
>

I'd like to find out about that. If it doesn't work, it'll be easily
provable that it can't be done.

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


Re: Sorting NaNs

2018-06-10 Thread Richard Damon
On 6/10/18 3:28 PM, Anders Munch wrote:
> Richard Damon wrote:
>
>> The two behaviors that I have heard suggested are:
>>
>> 1) If any of the inputs are a NaN, the median should be a NaN.
>> (Propagating the NaN as indicator of a numeric error)
>>
>> 2) Remove the NaNs from the input set and process what is left. If
>> nothing, then return a NaN (treating NaN as a 'No Data' placeholder).
>
> 3) Raise an exception.
>
> I can't believe anyone even suggested 2).  "In the face of ambiguity,
> refuse the temptation to guess."
>
> regards, Anders
>
Many people doing statistics (mis-)use 'NaN' as a flag for 'missing data
for this record'. If you want the statistic of a sample as an estimate
of the statistic of the population, then omitting 'missing data' can be
a reasonable option. I will agree that I see issues with this attitude,
but it isn't uncommon.

-- 
Richard Damon

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


[issue23831] tkinter canvas lacks of moveto method.

2018-06-10 Thread Matthias Kievernagel


Change by Matthias Kievernagel :


--
nosy: +mkiever

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why exception from os.path.exists()?

2018-06-10 Thread Marko Rauhamaa
Chris Angelico :
> Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
> I'd like to see what their file names are represented as.

I think Bev already explained it. At Unix level, you can't have slashes
in filenames. At GUI level, you can't have colons in filenames. Unix
slashes are bijectively mapped to colons in the GUI.

So what you are asking can't really be tried out.


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


Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Chris Angelico
On Sun, Jun 10, 2018 at 11:03 PM, Gregory Ewing
 wrote:
> Chris Angelico wrote:
>>
>> You cannot, to
>> my knowledge, publish a game for the PS4 or Xbox 360 without
>> permission from Nintendo or Microsoft.
>
>
> That's because, since we *do* have copyright laws, the
> manufacturers of the consoles are able to make money by
> selling the software as well as the hardware -- and they
> want a monopoly on that source of income.
>
> If there was no copyright, they wouldn't be able to
> make money from the software side alone, so there would
> be no incentive for them to lock things down that way.
> The opposite, in fact -- the more games are available
> for a machine, the more people are going to want to
> buy it.
>
>> Nobody can sell software without also selling
>> hardware, which is an expensive industry to get into.
>
>
> I don't follow what you're saying here. Are you suggesting
> that nobody would write any software for someone else's
> hardware if they couldn't sell it for money? Experience
> with the open source community that we do have suggests
> otherwise.
>

Nice work there. You trimmed key parts of my post, and then responded
to me out of context. Go back and read my actual post, then respond to
what I actually said. Thanks!

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


[issue33610] IDLE: Make multiple improvements to CodeContext

2018-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 08a1b133925f50903691c77fa9c23b618abc89f2 by Miss Islington (bot) 
in branch '3.6':
bpo-33610: Update IDLE Code Context doc entry (GH-7597)
https://github.com/python/cpython/commit/08a1b133925f50903691c77fa9c23b618abc89f2


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Why exception from os.path.exists()?

2018-06-10 Thread Chris Angelico
On Mon, Jun 11, 2018 at 12:45 AM, Bev in TX  wrote:
>>  * One with an embedded / in the file name
>
> This is easily done in Finder, where I created a folder named "my/slash”.
> When I list it at the command line in Terminal, this shows up as "my:slash”, 
> with the slash shown as a colon.
> If I create a file with a colon in its name at the command line, that file 
> name acts the same way:
>
> $ touch ‘my:colon"
> $ ls
> my:colon
> my:slash
>
> In Finder they both display as:
> my/colon
> my/slash
>
> However, if you use Finder’s “Copy item as Pathname” option, then you will 
> again see the colon.
>
> /Users/bev/Training/myPython/pygroup/files/my:colon
> /Users/bev/Training/myPython/pygroup/files/my:slash
>
> But if you paste that folder’s name in Finder’s “Go to Folder” option, it 
> converts it to the following, and goes to that folder:
>
> /Users/bev/Training/myPython/pygroup/files/my/slash/slash

Can you try creating "spam:ham" and "spam/ham"? If they're both legal,
I'd like to see what their file names are represented as.

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


[issue33610] IDLE: Make multiple improvements to CodeContext

2018-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 2adfeef1853262b207a1993e523f0f3ba708dd9f by Miss Islington (bot) 
in branch '3.7':
bpo-33610: Update IDLE Code Context doc entry (GH-7597)
https://github.com/python/cpython/commit/2adfeef1853262b207a1993e523f0f3ba708dd9f


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-06-10 Thread Chris Angelico
On Mon, Jun 11, 2018 at 2:49 AM,   wrote:
>
> excuse but sorry
> i took the time to manually write the code error from the traceback as you 
> said
> and thats because i cant seem to find a way to attach files here..which would 
> make it so easier for me and also i could attach snippets of the actual 
> source code..and i asked the forum how i can attach files or also i asked for 
> an email adress but i didnt get a responsealso i find this is why 
> programmers can have a bad reputation..cuz of examples of people like 
> yourself barking out orders and getting upset for no good reason at tall..now 
> one including myself is giving you obligations to answer my queires 
> ok??..im not your slave the way you say that i have to follow 
> instructions..so why do you kindly just buzz off of my thread since it makes 
> you and myself really get annoyed..ok..
> --

Nope, you're not our slave. But here's the thing: none of us is your
slave either. If you don't want help, we don't have to provide any.

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


Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-06-10 Thread bellcanadardp
On Friday, 8 June 2018 18:26:28 UTC-4, Cameron Simpson  wrote:
> On 05Jun2018 06:42, bellcanada...@gmail.com  wrote:
> >On Sunday, 3 June 2018 20:11:43 UTC-4, Steven D'Aprano  wrote:
> >> Don't retype a summary of what you think the error is. "character
> >> undefieed" is not a thing, and there is no such thing as "byte 1x09".
> >>
> >> You need to COPY AND PASTE the EXACT error that you get. Not just the
> >> last line, the error message, but the FULL TRACEBACK starting from the
> >> line "Traceback" and going to the end.
> [...]
> >
> >here is the exact error full message
> >in the attachment...UPDATE..i am manually modifying this reply..i tried to 
> >answer by my gmail but i get errors and i couldnt find this webpage till 
> >today and it doesnt accept attachments..so many you can for future provide 
> >an email if thats ok...anyway i will write the error manually here:
> 
> Many of us read this group/list via the mailing list python-list@python.org.  
> I've CCed it here. Just avoid Google Groups, they're an awful interface to 
> both 
> usenet and mailing lists.
> 
> >File 
> >"C:\Users\Robert\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py",
> > 
> >line 23, in decode
> >return codecs.charmap_decode(input,self.errors,decoding_table[0]
> >UnicodeDecodeError: 'charmap'codec can't decode byte 0x9d in position 7414: 
> >character maps to 
> 
> As Steven has remarked, this is not the complete traceback he requested, just 
> the end. We need to know the entire execution stack.
> 
> >for the record i did not puprosely set the code or decode o encode to 
> >cp-1252; 
> >this is a 3rd party script i have from the internet thats all
> 
> Can you say where it came from and how you fetched it? That may affect how 
> the 
> file got into this situation and how it might be repaired.
> 
> It might also let us fetch the file ourselves to look at it.
> 
> >this a  set of files that runs find in python 2.7
> >i am trying to run it in python 3 becuz i was told in 2020 python 2 will no 
> >longer be supported
> >not sure if that really matters for my script
> 
> It may not matter, but as a general rule you should try to use Python 3 for 
> new 
> stuff. Python 2 is effectively end of life.
> 
> >it runs completey fine in python 2, so for me the issue is with python 3 and 
> >its changes relative to python 2
> 
> It is possible that Python 2 is just glossing over the problem; Python 3 has 
> a 
> more rigorous view of character data.
> 
> Cheers,
> Cameron Simpson 

here is the full error once again
to summarize, my script works fine in python2 
i get this error trying to run it in python3
plz see below after the error, my settings for python 2 and python 3
for me it seems i need to change some settings to 'utf-8'..either just in 
python 3, since thats where i am having issues or change the settings to 
'utf-8' both in python 2 and 3i would appreciate feedback b4 i do some 
trial and error
thanks for the consideration
tommy

***
Traceback (most recent call last):

File "createIndex.py", line 132, in 
c.createindex()

File "creatIndex.py", line 102, in createIndex
pagedict=self.parseCollection()

File "createIndex.py", line 47, in parseCollection
for line in self.collFile:

File 
"C:\Users\Robert\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py",
 line 23, in decode

return codecs.charmap_decode(input,self.errors,decoding_table[0]
UnicodeDecodeError: 'charmap'codec can't decode byte 0x9d in position 7414: 
character maps to 
* 

***
python 3 settings
import sys
 import locale
locale.getpreferredencoding()
'cp1252'
 sys.stdout.encoding
'cp1252'
 sys.getdefaultencoding()
'utf-8'
sys.getfilesystemencoding()
'utf-8'
 sys.stdin.encoding
'cp1252'
 sys.stderr.encoding
'cp1252'

PYTHON 2 settings
import sys
 import locale
 locale.getpreferredencoding()
'cp1252'
 sys.stdout.encoding
'cp1252'
 sys.getdefaultencoding()
'ascii'
 sys.getfilesystemencoding()
'mbcs'
 sys.stdin.encoding
'cp1252'
 sys.stderr.encoding
'cp1252'
***
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Distributing a Python module as .rpm and .deb packages across major distributions

2018-06-10 Thread Barry



> On 8 Jun 2018, at 18:04, adam.pre...@gmail.com wrote:
> 
> I have a situation where internally I need to distribute some Python code 
> using Linux packages rather than simply relying on wheel files. This seems to 
> be a solved problem because a lot of Python modules clearly get distributed 
> as .rpm and .deb. It's not completely unreasonable because soon I will have 
> some other modules that are depending on binary applications that are also 
> coming in from packages, and having the system package manage resolve and 
> install all this is convenient. I'm not really in a political position to 
> change that policy, for what it's worth.
> 
> I'm still stuck in Python 2.7 here for at least a few more months. Also, it 
> probably helps to know this is a pure Python module that doesn't have to 
> compile any native code.
> 
> Creating a package itself isn't a problem. In my case, I bandied with the 
> bdist_rpm rule in setup.py, and used stdeb to add a bdist_deb rule. I get rpm 
> and deb files from these, but they seem to be plagued with a problem of 
> making assumptions about paths based on my build environment. I'm building on 
> an Ubuntu rig where Python modules are installed into dist-packages. The rpm 
> package will try to install my module into dist-packages instead of 
> site-packages on a Red Hat rig. I haven't yet tried the Debian package on 
> different rigs, but the stdeb documentation did call out that this likely 
> won't work.
> 
> I'm wondering first if many of the modules we see in packages right now are 
> actually literally being built using Jenkins or some other CD tool on every 
> major OS distribution. If that's the case then at least I know and I can try 
> to do that. I was surprised that I couldn't easily provide some additional 
> flags. I believe I can specify a setup.cfg that can override the module 
> installation path, and I think I can do a little shell script to just rotate 
> different setup.cfg files through, but I can't help but wonder if I'm even on 
> the right path.
> -- 
> https://mail.python.org/mailman/listinfo/python-list

The way I learn about the details of RPM packaging is to look at examples like 
what I wish to achieve.

I would go get the source RPM for a python2 package from each distro you want 
to supoort and read its .spec file.

I see on fedora that the way they install packages that are from pypi makes it 
possible to use pip list to see them.

Barry


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


[issue33610] IDLE: Make multiple improvements to CodeContext

2018-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

General Update: We have done 1, 3, 7, 8, 9, 11, 17, 21.  Very nice.  A 
re-organized list of the remainder (with old numbers).

Docs:
D1: idle.rst subsection on Code Context (19, see #33642).
D2: What's New in 3.6.6 and 3.7.0 (20).

Menu
M1: put Code Context and Zoom Height on same menu (5).
M2: Add Show/Hide Code Context (5).
M3. Gray out menu entry when not applicable (6).
M3: Shortcut for CC? (new),

Code Context Display
C1. Add vertical scrollbar if lines > maxlines (12).
C2. Add horizontal scrollbar if add to text (13).

Internal Changes
I1. Unspecified code cleanups for codecontext.py (2)
I2. Reduce events (4). Font change notification (15). Text active or text 
changed notification (16).

External Changes
E1. Mark blocks in editor (10, unlikely).
E2. Navigate by blocks in editor (14).
E3. Error check maxlines in configdialog (18).

D1 is PR 7579 and backports.  D2 was done on #33820 and #33821.

For M1, I would still like to move Zoom Height to Options with a separate bar 
after IDLE settings.

--
keywords: +3.5regression -patch
stage: patch review -> 

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33610] IDLE: Make multiple improvements to CodeContext

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7220

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33610] IDLE: Make multiple improvements to CodeContext

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7221

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33610] IDLE: Make multiple improvements to CodeContext

2018-06-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset af4b0130d44bf8a1ff4f7b46195d1dc79add444a by Terry Jan Reedy in 
branch 'master':
 bpo-33610: Update IDLE Code Context doc entry (GH-7597)
https://github.com/python/cpython/commit/af4b0130d44bf8a1ff4f7b46195d1dc79add444a


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Stefan's headers [was:Names and identifiers]

2018-06-10 Thread Gene Heskett
On Sunday 10 June 2018 14:42:02 Rick Johnson wrote:

> Gene Heskett wrote:
> > I rather like that idea. Unforch, who would be in charge of keeping
> > the books uptodate? The USTPO? Of course that would expand another
> > guvmnt agencies payroll x10, and its a waste of taxpayer dollars
> > since Albert retired anyway.
>
> What century are you trapped in pal? Heck, all you need is a
> Godaddy(c) website and a simple HTML form (Hell, they even gots
> templates for that!!!).
>
> > Here in the hew hess aye, we originally had a copyright term of 7
> > years, renewable just once for another 7. I will date myself by
> > saying I can actually remember those days.  But then Disney started
> > buying senators and congressmen, and we now have this asinine
> > lifetime +70 years just to keep Mickey Mouse and Company's (oh, and
> > don't forget a widow named Cher) income rolling in.
>
> Yeah, and they've sucked up every independent animation house between
> here and Kathmandu.
>
Probably farther than that.

> > Thats the sort of stuff usually found, warm and squishy, on the
> > ground behind the male of the bovine specie.
>
> Huh? The female bovines don't defecate where you come from? Well then!
> i see! Say hello to Qin-I, would ya?

Oh they do, but have the great good sense to take several steps away from 
the evidence, if they can. :)

Qin-I? You lost me there.

-- 
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33824] Settign LANG=C modifies the --version behavior

2018-06-10 Thread Ned Deily


Ned Deily  added the comment:

Odd. I see the same behavior with the python.org macOS builds so it's not just 
Fedora.

--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33824] Settign LANG=C modifies the --version behavior

2018-06-10 Thread Miro Hrončok

New submission from Miro Hrončok :

On 3.6, setting LANG to C did not affect the --version behavior:

$ python3.6 --version
Python 3.6.5

$ LANG=C python3.6 --version
Python 3.6.5

On 3.7.0b5 it does.

$ python3.7 --version
Python 3.7.0b5

$ LANG=C python3.7 --version
Python 3.7.0b5 (default, Jun  1 2018, 03:54:41) 
[GCC 8.1.1 20180502 (Red Hat 8.1.1-1)]



My locale:

LANG=cs_CZ.utf8
LC_CTYPE="cs_CZ.utf8"
LC_NUMERIC="cs_CZ.utf8"
LC_TIME="cs_CZ.utf8"
LC_COLLATE="cs_CZ.utf8"
LC_MONETARY="cs_CZ.utf8"
LC_MESSAGES="cs_CZ.utf8"
LC_PAPER="cs_CZ.utf8"
LC_NAME="cs_CZ.utf8"
LC_ADDRESS="cs_CZ.utf8"
LC_TELEPHONE="cs_CZ.utf8"
LC_MEASUREMENT="cs_CZ.utf8"
LC_IDENTIFICATION="cs_CZ.utf8"
LC_ALL=


BTW I'm running Fedora builds of Python, where we have PEP 538 on 3.6 as well 
https://fedoraproject.org/wiki/Changes/python3_c.utf-8_locale

--
messages: 319238
nosy: hroncok
priority: normal
severity: normal
status: open
title: Settign LANG=C modifies the --version behavior
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33820] IDLE subsection of What's New 3.6

2018-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 969759e11ecfbd662642ba4fb23159faf56ee859 by Miss Islington (bot) 
in branch '3.6':
bpo-33820: Fix IDLE What's New typo (GH-7594)
https://github.com/python/cpython/commit/969759e11ecfbd662642ba4fb23159faf56ee859


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Sorting NaNs

2018-06-10 Thread Anders Munch

Richard Damon wrote:


The two behaviors that I have heard suggested are:

1) If any of the inputs are a NaN, the median should be a NaN.
(Propagating the NaN as indicator of a numeric error)

2) Remove the NaNs from the input set and process what is left. If
nothing, then return a NaN (treating NaN as a 'No Data' placeholder).


3) Raise an exception.

I can't believe anyone even suggested 2).  "In the face of ambiguity, 
refuse the temptation to guess."


regards, Anders

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


[issue33820] IDLE subsection of What's New 3.6

2018-06-10 Thread miss-islington


miss-islington  added the comment:


New changeset 3da01813c83d23922798b398bc00f465593c80da by Miss Islington (bot) 
in branch '3.7':
bpo-33820: Fix IDLE What's New typo (GH-7594)
https://github.com/python/cpython/commit/3da01813c83d23922798b398bc00f465593c80da


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: user defined modules

2018-06-10 Thread Rick Johnson
Sharan Basappa wrote:
> Is there a specific location where user defined modules
> need to be kept?

My advice is that any location is a good location so long as
the location you chose is _not_ a part of the PythonXY
directory tree. 

For example, on a windoze machine (and in Python2.x at
least), the PythonXY directory is placed (by default) at the
root of the default drive (usually C drive). Your scripts
(on a windows machine) should be (idealy) somewhere in the
os.path.expanduser('~/Documents') tree. 

Personally i use a .pth file to point Python in the
direction of my library modules. Unlike the old time
masochist, i just hate having to repeat myself. Thus, like
most modern folk, i have learned that copy+paste and "set-
it-and-forget-it" text file are a computer users best
friend and loyal companions.

## MAP ##
C:/
   PythonXY/
   config.pth

The contents of my .pth file is simply an unquoted string
representing the path to my library folders. (something like
this)

## PTH FILE CONTENT ##
C:/.../Documents/path/to/my/lib/folder

That's it!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33610] IDLE: Make multiple improvements to CodeContext

2018-06-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +7219
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33820] IDLE subsection of What's New 3.6

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7218

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33820] IDLE subsection of What's New 3.6

2018-06-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7217

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >