[issue28806] Improve the netrc library

2017-01-04 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +r.david.murray -haypo

___
Python tracker 

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



[issue26867] test_ssl test_options fails on ubuntu 16.04

2017-01-04 Thread Xiang Zhang

Xiang Zhang added the comment:

This test still fails with lastest Py2.7 on Ubuntu 16.10. Could we backport the 
patch to silence the failure?

./python -m test.regrtest test_ssl
[1/1] test_ssl
test test_ssl failed -- Traceback (most recent call last):
  File "/home/angwer/py2.7/Lib/test/test_ssl.py", line 780, in test_options
self.assertEqual(0, ctx.options)
AssertionError: 0 != 33554432L

1 test failed:
test_ssl

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue29147] registry value to be cleared when python is uninstalled

2017-01-04 Thread jha.amit6666

jha.amit added the comment:

Before I read your comment, I ran disk clean up which deleted everything.

--

___
Python tracker 

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



[issue29166] Spam

2017-01-04 Thread Zachary Ware

Changes by Zachary Ware :


--
components:  -asyncio
nosy:  -Mama Mama
title: AT tech email support number <1 855 338 0710 Spam
versions:  -Python 3.6

___
Python tracker 

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



[issue29166] AT tech email support number <1 855 338 0710<AT tech email support phone number

2017-01-04 Thread Xiang Zhang

Changes by Xiang Zhang :


Removed file: http://bugs.python.org/file46152/1 855 338 0710 AT tech email 
support phone number AT email support number.jpg

___
Python tracker 

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



[issue29166] AT tech email support number <1 855 338 0710<AT tech email support phone number

2017-01-04 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy:  -gvanrossum, yselivanov
resolution:  -> not a bug
stage:  -> 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



[issue29166] AT tech email support number <1 855 338 0710<AT tech email support phone number

2017-01-04 Thread Xiang Zhang

Changes by Xiang Zhang :


--
Removed message: http://bugs.python.org/msg284711

___
Python tracker 

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



[issue29096] unicode_concatenate() optimization is not signal-safe (not atomic)

2017-01-04 Thread Armin Rigo

Changes by Armin Rigo :


Added file: http://bugs.python.org/file46153/patch1.diff

___
Python tracker 

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



[issue29166] AT tech email support number <1 855 338 0710<AT tech email support phone number

2017-01-04 Thread Mama Mama

New submission from Mama Mama:

AT tech email support number <1 855 338 0710$$$>>>1 855 338 0710 <<$<$_)_)AT 
tech email support phone number AT email support number
&$$$>>>1 855 338 0710 <<$<$_)_)AT tech 
email support phone number AT email support number
1 855 338 0710  moto khama wla AT tech email support number AT email 
support number  AT tech email support phone number at email technical 
support number

--
components: asyncio
files: 1 855 338 0710 AT tech email support phone number AT email support 
number.jpg
messages: 284711
nosy: Mama Mama, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: AT tech email support number <1 855 338 0710

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



[issue29096] unicode_concatenate() optimization is not signal-safe (not atomic)

2017-01-04 Thread Armin Rigo

Changes by Armin Rigo :


Removed file: http://bugs.python.org/file46150/patch1.diff

___
Python tracker 

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



[issue29096] unicode_concatenate() optimization is not signal-safe (not atomic)

2017-01-04 Thread Armin Rigo

Changes by Armin Rigo :


Added file: http://bugs.python.org/file46151/patch2.diff

___
Python tracker 

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



[issue29096] unicode_concatenate() optimization is not signal-safe (not atomic)

2017-01-04 Thread Armin Rigo

Armin Rigo added the comment:

The signal handler is called between the INPLACE_ADD and the following 
STORE_FAST opcode, never from string_concatenate() itself.  A fix would be to 
make sure signal handlers are not called between these two opcodes.  See the 
minimal, proof-of-concept patch #1.  A possibly better fix, which at least 
should match the SETUP_FINALLY handling in the ticker handler, is attached as 
patch #2.  (Patches against 2.7.13)

--
keywords: +patch
Added file: http://bugs.python.org/file46150/patch1.diff

___
Python tracker 

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



[issue29165] Use forward compatible macro in example code for creating new type

2017-01-04 Thread INADA Naoki

New submission from INADA Naoki:

https://docs.python.org/2.7/extending/newtypes.html#the-basics uses 
PyObject_HEAD_INIT for type object header.

static PyTypeObject noddy_NoddyType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/

This code isn't compatible with Python 3.  In Python 3, PyVarObject_HEAD_INIT 
is used instead.
https://docs.python.org/3.6/extending/newtypes.html#the-basics

static PyTypeObject noddy_NoddyType = {
PyVarObject_HEAD_INIT(NULL, 0)

This code is compatible with Python 2.


This example code can be copy and pasted when creating new extension.
If people start writing Python 2 extension, and forward port it to Python 3,
this small incompatibility cause compile error.

Let's use more forward compatible and short code for example.

--
assignee: docs@python
components: Documentation
messages: 284709
nosy: docs@python, inada.naoki
priority: normal
severity: normal
status: open
title: Use forward compatible macro in example code for creating new type
type: enhancement
versions: Python 2.7

___
Python tracker 

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



Re: Clickable hyperlinks

2017-01-04 Thread Terry Reedy

On 1/5/2017 12:11 AM, Deborah Swanson wrote:

Terry Reedy wrote, on January 04, 2017 3:58 PM



To have a string interpreted as a clickable link, you send the string

to

software capable of creating a clickable link, plus the information
'this is a clickable link'*.  There are two ways to tag a string as a
link.  One is to use markup around the url in the string itself.
'' and html are example.  Python provides multiple to make this
easy. The other is to tag the string with a separate argument.  Python



provides tkinter, which wraps tk Text widgets, which have a powerful

tag

system.  One can define a Link tag that will a) cause text to be
displayed, for instance, blue and underlined and b) cause clicks on

the

text to generate a web request.  One could then use
   mytext.insert('insert', 'http://www.example.com', Link)
Browser must do something similar when they encounter when they
encounter html link tags.


I've actually moved on from my original question to one of opening a url
in a browser with python, which seems to be a much more easily achieved
goal.



But someone else mentioned tkinter, and I looked at it while ago but
haven't used it for anything. That really could be the way to go if you
want to make clickable links, although you still need some kind of
internet engine to open the url in a browser.


IDLE allows a user to add help menu entries that, when clicked on, open 
either a local file or an internet url.  For instance, adding the pair
'Pillow' and "https://pillow.readthedocs.io/en/latest/; in the Settings 
dialog adda "Pillow" to the help menu (after the standard stuff). 
Clicking on Help => Pillow opens 
"https://pillow.readthedocs.io/en/latest/; in the default browswer. 
IDLE just used the webbrowser module to do this.  No use re-inventing 
the wheel.  If instead "Pillow" were a link in text, the click handler 
should do something similar.



You say, "There are two ways to tag a string as a link.  One is to use
markup around the url in the string itself. '' and html are
examples.  Python provides multiple ways to make this easy."

Can you tell me where I'd begin to look for these? Are they in the core
language, or in packages?


I was referring to using either % or .format string formatting.  Both 
are in the core and described somewhere in the Library manual.  '%' 
should be in the Symbols page of the Index and 'format' on the 'F' page.


--
Terry Jan Reedy

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


[issue29145] failing overflow checks in replace_*

2017-01-04 Thread Xiang Zhang

Xiang Zhang added the comment:

> It would be better to write the code in the same form as in 3.x. This could 
> help backporting other patches if needed.

Yes, it is. :-) I only had a fast glance at at 3.x codes and thought they 
didn't share much. :-( But apparently I was wrong. The new patch backports 3.x 
code.

--
Added file: http://bugs.python.org/file46149/replace-overflow-check-v2.patch

___
Python tracker 

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



Re: Clickable hyperlinks

2017-01-04 Thread Steven D'Aprano
On Thursday 05 January 2017 14:22, Rustom Mody wrote:

> This thread does lead to the question:
> Is the Url type in python less first-class than it could be?
> 
> In scheme I could point to something like this
> https://docs.racket-lang.org/net/url.html

Those docs say:

"To access the text of a document from the web, first obtain its URL 
AS A STRING..." [emphasis added]

which means that URLs are not a first-class data type in Racket at all. URLs in 
Racket are just strings, exactly the same as in Python.

There is a url struct:

https://docs.racket-lang.org/net/url.html#%28def._%28%28lib._net%2Furl-
structs..rkt%29._url%29%29

but there no first-class syntactic support for them, as ints and lists have in 
Python:

123  # rather than int("123")
[1, 2]  # rather than list(1, 2)


> Is there something equivalent in python?

Just like Racket, URLs in Python are not first-class. They start as a string, 
and then you parse them into a tuple:

https://docs.python.org/3/library/urllib.parse.html

https://docs.python.org/2/library/urlparse.html


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

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


RE: Clickable hyperlinks

2017-01-04 Thread Deborah Swanson
Terry Reedy wrote, on January 04, 2017 3:58 PM
> 
> On 1/4/2017 4:32 AM, Deborah Swanson wrote:
> 
> > My original question was whether python had anything to provide this

> > functionality, and the answer appears to be a resounding NO!!!
> 
> I would say 'Yes, but with user effort'.
> 
> To have a string interpreted as a clickable link, you send the string
to 
> software capable of creating a clickable link, plus the information 
> 'this is a clickable link'*.  There are two ways to tag a string as a 
> link.  One is to use markup around the url in the string itself. 
> '' and html are example.  Python provides multiple to make this 
> easy. The other is to tag the string with a separate argument.  Python

> provides tkinter, which wraps tk Text widgets, which have a powerful
tag 
> system.  One can define a Link tag that will a) cause text to be 
> displayed, for instance, blue and underlined and b) cause clicks on
the 
> text to generate a web request.  One could then use
>mytext.insert('insert', 'http://www.example.com', Link) 
> Browser must do something similar when they encounter when they 
> encounter html link tags.

I've actually moved on from my original question to one of opening a url
in a browser with python, which seems to be a much more easily achieved
goal.

But someone else mentioned tkinter, and I looked at it while ago but
haven't used it for anything. That really could be the way to go if you
want to make clickable links, although you still need some kind of
internet engine to open the url in a browser.  PyCharm has clickable
local links in its console output, but they're not internet enabled,
they just jump to the relevant line of code.

You say, "There are two ways to tag a string as a link.  One is to use
markup around the url in the string itself. '' and html are
examples.  Python provides multiple ways to make this easy." 

Can you tell me where I'd begin to look for these? Are they in the core
language, or in packages?

> * If the software directly recognizes a bare url such as 
> 'http://www.example.com' as a link, without further 
> indication, then it 
> should have a way to disable conversion to a clickable link.

One would think so.  Thanks for all your info!

> 
> -- 
> Terry Jan Reedy


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


Re: Hey, I'm new to python so don't judge.

2017-01-04 Thread Terry Reedy

On 1/4/2017 9:51 PM, Steven D'Aprano wrote:

On Thursday 05 January 2017 10:21, Terry Reedy wrote:



IDLE does this when one runs code from the editor, because it
cannot/should not inject error messages into the editor buffer...
AND it replaces the ^ with red highlighting of the code pointed to.  No
information is lost.  Apparently, some beginners do not see the
connection between the SyntaxError box and the red highlighting.


Some people may not even be able to distinguish red from other colours. Those
with red-green colourblindness will probably see the red as a sort of muddy
brown that hardly stands out as different from usual black text.

http://wearecolorblind.com/

One should never use colour alone as the only indicator of status.

http://stackoverflow.com/questions/1498669/gui-design-for-color-blindness

http://davemeeker.com/color-blind-considerations-for-ui-design/


I have described what I inherited.  After I wrote this, it occurred to 
me that perhaps the error color should be flashing, a bell rung, and 
maybe even the line and column numbers included in the box.



I
think I should add something to the box.  Maybe 'The error was detected
at the point of the red highlighting.'



I just tested the REPL in idle for 2.7.4, and I get this:


print Hello World

SyntaxError: invalid syntax


where "print" is green text on a white background, and "World" is black text on
a red background. That may be unfriendly to the colourblind, and makes coping
and pasting the error less helpful. I suggest:

- check the colours in a colourblindness simulator, and pay attention to the
contrast; is the text still clear?


User can configure most of the syntax colors.  I am not sure ir the 
error 'red' is one of them or not.


#Suggestion 1

- include the ^ caret as the primary status indicator, delegating colour to
secondary; this makes errors in IDLE a little more like the same experience in
the standard REPL.


Indeed, why not both in the Shell?  IDLE must currently be deleting the 
caret line.



If I open a Python file containing:

print Hello World

and choose "Check Module", IDLE highlights the word "World" in red and displays
a dialog showing:

There's an error in your program:
invalid syntax


#Suggestion 2

Change the dialog box to display a read-only text field showing the traceback:

  File "idletest.py", line 1
print Hello World
^
SyntaxError: invalid syntax


#Suggestion 3

and add a button "Copy traceback" to allow the user to copy the text of the
traceback and paste it into an email.

(Strictly speaking, the Copy button is redundant if the user can select the
text in the field, but beginners may not realise the text can be selected.)


Thank you for the suggestions.  I will keep a copy of this.

--
Terry Jan Reedy

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


RE: Clickable hyperlinks

2017-01-04 Thread Deborah Swanson
Chris Angelico wrote, on January 04, 2017 8:27 PM
> 
> On Thu, Jan 5, 2017 at 3:19 PM, Deborah Swanson 
>  wrote:
> > I downloaded the code from the Package Index, but there really
wasn't 
> > much in it. This is the entire .py file:
> 
> Ehh, wrong file. Try the one in the standard library:
> 
https://github.com/python/cpython/blob/master/Lib/antigravity.py
https://github.com/python/cpython/blob/master/Lib/webbrowser.py

>Or you can look in your installed Python - "import webbrowser;
print>(webbrowser.__file__)" will tell you where.
>
>ChrisA

Great! I will check it out. Thanks again!

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


RE: Clickable hyperlinks

2017-01-04 Thread Deborah Swanson
Chris Angelico wrote, on January 04, 2017 3:49 PM
> 
> On Thu, Jan 5, 2017 at 9:58 AM, Deborah Swanson 
>  wrote:
> >
> > Thank you, thank you! Finally, at least one person on this list
knows 
> > about something (anything) in the python world that is internet
aware. 

> 
> We've been all talking at cross purposes a bit in this 
> thread. Most of us thought you were talking about the *user 
> interface* of a clickable link, but if you're talking about 
> the *mechanics* of HTTP downloads, Python has excellent 
> facilities. I'd recommend checking out the third-party 
> 'requests' module on PyPI.

My original question was in fact whether there was a way to make
clickable hyperlinks in a console. I was persuaded after about 10
replies that the answer was no, and I tried with little success to
change the question to one of directly opening a url in a browser from
Python. (In hindsight, maybe I should have started a new thread.) Turns
out this version of the question does have good answers, but the revised
question got totally drowned out in the scramble to show that clickable
links in a console are a no-go. I'm not surprised that you didn't see
the shift in what I was looking for.


> 
> Hehe, yeah. It's a big joke that started because XKCD 
> mentioned the language. But actually, the source code for 
> antigravity.py itself isn't significant; all it does is call 
> on the webbrowser module:
> 
https://docs.python.org/3/library/webbrowser.html

I saw how insignificant antigravity's code is when I downloaded it from
the Package Index, and I copied the current version into another message
of yours that I replied to before this one. The original antigravity may
have used webbrowser, but now it just returns a url and hands it off to
import to open it. Maybe the author didn't know import had that
capability until after antigravity had been in the wild awhile.
Regardless, antigravity does point the way to pythonic web access.

> Yes, I'd gotten as far as figuring out that you don't need a clickable

> link. Code that opens a url in a browser would do the job just fine.
Or 
> the webbrowser.open("http://.../;) in a Linux terminal you 
> suggest. (I just have to get my Linux machine up and running again to 
> try it.)
>
> All in all, given that clickable urls in a console is a non-starter, 
> this hits the nail on the head. Many thanks again!

Cool! Glad I could help out a bit. There are a few different things you
can consider:

1) Open up a browser tab and let the user see the result
2) Make the request programmatically and access the text of the page for
further processing
3) Invoke a hidden web browser, browse to a URL, submit form data, etc,
as a means of testing a web server.

All three are possible. Take your pick!

ChrisA

I have a fourth option. I use Firefox with profiles and I could make one
specifically for this task, and have the code open the page in that
profile. This would give it it's own window, history, bookmarks, and
sqlite database, which could be handy if a particular url continues to
be a problem, or I want to track it for some reason. In this project I
usually would want to look at the photos, so a text download wouldn't be
that helpful. But it could be in some other project, and I expect to be
doing quite a bit of web work down the road.

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


[issue29164] make test always fail at 218/405 ( AssertionError: ', ' not found in '1234.5' )

2017-01-04 Thread Xiang Zhang

Xiang Zhang added the comment:

Could you provide your default locale setting, the result of 
`locale.setlocale(locale.LC_ALL, '')`?

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29096] unicode_concatenate() optimization is not signal-safe (not atomic)

2017-01-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +arigo

___
Python tracker 

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



Re: Clickable hyperlinks

2017-01-04 Thread Michael Torrie
On 01/04/2017 09:19 PM, Deborah Swanson wrote:
> Or, take a look at import's code and figure out how it opens a url in a
> browser. I imagine it's the 'webbrowser' module you mention. If it tries
> several methods, just pick one that will work for you.

webbrowser is part of the python standard library:
https://docs.python.org/3/library/webbrowser.html

It uses whatever method is appropriate for the platform for opening a
url in the user's default browser.

> Or, take a look at this Index of Packages Matching 'webbrowser' (~50
> packages)
> https://pypi.python.org/pypi?%3Aaction=search=webbrowser=sea
> rch

There may be modules in there that will be useful, but the first port of
call should always be the python standard library.

> D'Arcy was right, there's lots in python that's internet aware, though
> that wasn't the question I knew to ask.

That's why it's always good to state your end goal when asking about things.




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


Re: Clickable hyperlinks

2017-01-04 Thread Chris Angelico
On Thu, Jan 5, 2017 at 3:19 PM, Deborah Swanson
 wrote:
> I downloaded the code from the Package Index, but there really wasn't
> much in it. This is the entire .py file:

Ehh, wrong file. Try the one in the standard library:

https://github.com/python/cpython/blob/master/Lib/antigravity.py
https://github.com/python/cpython/blob/master/Lib/webbrowser.py

Or you can look in your installed Python - "import webbrowser;
print(webbrowser.__file__)" will tell you where.

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


[issue29162] pyshell.py: name 'sys' is not defined

2017-01-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I agree that depending on the incidental import is a bug.  Tkinter could 
change, or I might change 'from tkinter import *' to 'from tkinter import Tk, 
...' or 'import tkinter as tk'.

Serhiy, tkinter/__init__.py imports enum, sys, and re under their own names, so 
that * imports incidentally import them into other programs.  I believe it is 
customary for library modules to underscore stdlib imports to prevent this: 
"import enum as _enum", etc.  But I don't remember is this is in the devguide.  
Do you think we should make the change to tkinter?

--
nosy: +serhiy.storchaka
resolution:  -> fixed
stage: needs patch -> 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



[issue29142] urllib: no_proxy variable values with leading dot not properly handled

2017-01-04 Thread Berker Peksag

Berker Peksag added the comment:

Note: We don't officially use pull requests yet. Current way of contributing to 
Python is documented at https://docs.python.org/devguide/patch.html

--
nosy: +berker.peksag

___
Python tracker 

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



RE: Clickable hyperlinks

2017-01-04 Thread Deborah Swanson
Chris Angelico wrote, on January 04, 2017 4:16 AM
> 
> Yeah, there's no simple answer; however, you'll find that 
> Python on many platforms is entirely capable of popping a URL 
> up in the user's default browser. Check this out:
> 
> >>> import antigravity

I downloaded the code from the Package Index, but there really wasn't
much in it. This is the entire .py file:

STRIP_URL = "http://xkcd.com/353/;

def start():
return STRIP_URL

And setup.py is equally disappointing:
from distutils.core import setup

setup(
name='antigravity',
version='0.1',
description='A really simple module that allow everyone to do
"import antigravity"',
author='Fabien Schwob',
author_email='antigrav...@x-phuture.com',
url='http://fabien.schwob.org/antigravity/',
packages=['antigravity'],
)

> This uses the 'webbrowser' module, which knows about a number 
> of different ways to open a browser, and will attempt them 
> all. So if you can figure out the UI part of things, actually 
> making the link pop up in a browser isn't too hard; for 
> instance, if you're doing OAuth at the command line and need 
> the user to go and authenticate, you can simply 
> webbrowser.open("http://.../;) and it'll DTRT.
> 
> ChrisA

All the action of antigravity must be done by the import statement. When
import opens a module that immediately returns a url, it must have a
mechanism to open it in a browser.

It would be very easy to do the same thing with my own .py and import it
into another .py.  

Or, take a look at import's code and figure out how it opens a url in a
browser. I imagine it's the 'webbrowser' module you mention. If it tries
several methods, just pick one that will work for you.

Or, take a look at this Index of Packages Matching 'webbrowser' (~50
packages)
https://pypi.python.org/pypi?%3Aaction=search=webbrowser=sea
rch

D'Arcy was right, there's lots in python that's internet aware, though
that wasn't the question I knew to ask.

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


[issue29162] pyshell.py: name 'sys' is not defined

2017-01-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 52d671684342 by Terry Jan Reedy in branch '3.6':
Issue #29162: Don't depend on 'from tkinter import *' importing sys.
https://hg.python.org/cpython/rev/52d671684342

--
nosy: +python-dev

___
Python tracker 

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



Re: Clickable hyperlinks

2017-01-04 Thread Chris Angelico
On Thu, Jan 5, 2017 at 2:24 PM, D'Arcy Cain  wrote:
> Think of it this way.  You drop a ring down a drain.  You can ask two
> questions, "How do I remove a drain trap?" or "How do I recover a ring that
> I dropped down the drain?"  If you ask the first question you will get lots
> of advice on tools and buckets, etc.  People will assume that the drain is
> blocked.  Ask the second question and someone might mention a magnet and a
> piece of string.

... and then you follow up with "it's a gold ring, magnet won't touch
it", and we'll go off on a tangent about whether the ring is
sufficiently plain that it might be the One Ring, and shouldn't you
destroy it instead of retrieving it because that's what we do here
:D

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


[issue29162] pyshell.py: name 'sys' is not defined

2017-01-04 Thread Berker Peksag

Berker Peksag added the comment:

I misread your comment. I think we need to add "import sys" to that file so I'm 
reopening this.

--
keywords: +easy
resolution: not a bug -> 
stage: resolved -> needs patch
status: closed -> open
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



[issue29142] urllib: no_proxy variable values with leading dot not properly handled

2017-01-04 Thread Milan Oberkirch

Milan Oberkirch added the comment:

I added a line stripping dots from name, I think it makes sense to strip at the 
end as well (`example.com` is the same domain as `example.com.`).

--
nosy: +zvyn
pull_requests: +8

___
Python tracker 

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



[issue29162] pyshell.py: name 'sys' is not defined

2017-01-04 Thread Berker Peksag

Berker Peksag added the comment:

Great, thanks for following up with us.

--
resolution:  -> not a bug
stage:  -> resolved

___
Python tracker 

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



[issue29021] Custom functions in sqlite receive None on invalid UTF-8

2017-01-04 Thread Berker Peksag

Berker Peksag added the comment:

We can just fallback to the current behavior (i.e. return None) if the return 
type of text_factory(val_str) is not str, bytes or bytearray. I think this is 
also somewhat similar to what we do for the return values of 
sqlite3_column_text().

--
nosy: +berker.peksag
stage:  -> needs patch
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



[issue29159] Regression in bytes constructor

2017-01-04 Thread INADA Naoki

INADA Naoki added the comment:

@belopolsky
It is backported behavior from Python 3.5, to fix regression.

See code review discussion in #27704.
The first patch kept the behavior, but we simplified it in second patch.
That cause this regression.

--

___
Python tracker 

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



[issue29162] pyshell.py: name 'sys' is not defined

2017-01-04 Thread OO O

OO O added the comment:

to msg284696 - (view):

OK~ 
Sorry I found i forget to install tkinter before I run make.
so the "from tkinter import *" failed. ( sys not import ).

--
status: open -> closed

___
Python tracker 

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



Is there a good process or library for validating changes to XML format?

2017-01-04 Thread Sayth Renshaw
Afternoon

Is there a good library or way I could use to check that the author of the XML 
doc I am using doesn't make small changes to structure over releases?

Not fully over this with XML but thought that XSD may be what I need, if I 
search "python XSD" I get a main result for PyXB and generateDS 
(https://pythonhosted.org/generateDS/). 

Both seem to be libraries for generating bindings to structures for parsing so 
maybe I am searching the wrong thing. What is the right thing to search?

Cheers

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


[issue28180] sys.getfilesystemencoding() should default to utf-8

2017-01-04 Thread INADA Naoki

INADA Naoki added the comment:

On Linux, I think most people wants UTF-8:surrogateescape by default, without 
fighting against locale and environment variables.

There are already `#if defined(__APPLE__) || defined(__ANDROID__)` path for it.
How about adding configure option to use same logic? (say 
`--with-encoding=(locale|utf-8)`, preferred encoding is changed in same way).

It may help many people building Python themselves without having root 
privilege for generating C.UTF-8 locale.

--

___
Python tracker 

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



Re: Clickable hyperlinks

2017-01-04 Thread Rustom Mody
This thread does lead to the question:
Is the Url type in python less first-class than it could be?

In scheme I could point to something like this
https://docs.racket-lang.org/net/url.html

Is there something equivalent in python?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Clickable hyperlinks

2017-01-04 Thread D'Arcy Cain

On 2017-01-04 07:07 PM, Deborah Swanson wrote:

D'Arcy Cain wrote, on Wednesday, January 04, 2017 5:03 AM

In all the messages in this thread I still don't understand what this
"teensy advantage" is supposed to be.  Do you want to be able
to do this:

   make_web_link(http://...)

instead of:

   make_web_link("http://...;)


[...]


Is make_web_link("http://...;) valid python code? That's exactly the


It's just a made up name.  My point was that the first was syntactically 
incorrect and the second, while not a real method, was at least parseable.


I think I saw someone else mention this but it bears repeating.  When 
you ask a question make sure you are presenting the problem and not your 
solution to a secret problem.  Always tell us the actual problem you are 
trying to solve.  You will get much better answers.


Think of it this way.  You drop a ring down a drain.  You can ask two 
questions, "How do I remove a drain trap?" or "How do I recover a ring 
that I dropped down the drain?"  If you ask the first question you will 
get lots of advice on tools and buckets, etc.  People will assume that 
the drain is blocked.  Ask the second question and someone might mention 
a magnet and a piece of string.


--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
--
https://mail.python.org/mailman/listinfo/python-list


[issue29162] pyshell.py: name 'sys' is not defined

2017-01-04 Thread Berker Peksag

Berker Peksag added the comment:

I think the OP is talking about Lib/idlelib/pyshell.py. The relevant changeset 
is 76f831e4b806. "from tkinter import *" imports the sys module as a 
side-effect. OO O, did you notice this by reading the code or by using a tool 
like flake8?

--
nosy: +berker.peksag
type: crash -> behavior

___
Python tracker 

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



[issue29162] pyshell.py: name 'sys' is not defined

2017-01-04 Thread Milan Oberkirch

Milan Oberkirch added the comment:

pyshell.py is not part of CPython, this is the wrong place to report a bug like 
this.

--
nosy: +zvyn

___
Python tracker 

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



[issue29160] pow with three int arguments works like it had two arguments

2017-01-04 Thread Pavel Chuvakhov

Pavel Chuvakhov added the comment:

Sorry about script, n1 should be n, and n2 should be m. Updated script is 
attached.

Ofc mpz is a way out. One also could cast int( np.int32 ) explicitly. I just 
wanted to underline that the best way is to hide all this stuff from a user and 
not make the user think what kind of int subtypes he should use. Python is a 
pretty language, isn't it? =)

Ones this is bug/limitation of numpy, shall we make a report for 'numpy guys' 
directly?

--
components: +Distutils -Interpreter Core
Added file: http://bugs.python.org/file46148/pow-bug_repor-upd.py

___
Python tracker 

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



Re: Clickable hyperlinks

2017-01-04 Thread D'Arcy Cain

On 2017-01-04 05:58 PM, Deborah Swanson wrote:

the user to go and authenticate, you can simply
webbrowser.open("http://.../;) and it'll DTRT.


Thank you, thank you! Finally, at least one person on this list knows
about something (anything) in the python world that is internet aware.


Lots of things in Python are Internet aware.  That's not the question 
you asked though.



It's also occurred to me that Beautifulsoup downloads data from a url,
so that code must have access to some kind of an internet engine too.


Nope.  You have to feed it HTML.  You either need to generate that or 
capture it from somewhere.


--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
--
https://mail.python.org/mailman/listinfo/python-list


Re: Hey, I'm new to python so don't judge.

2017-01-04 Thread Steven D'Aprano
On Thursday 05 January 2017 10:21, Terry Reedy wrote:

> On 1/3/2017 10:15 PM, Dennis Lee Bieber wrote:
> 
>> And that statement tells us you are trying to run from within some
>> IDE/editor which is trapping Python exceptions and producing a dialog
>> box for them.
> 
> IDLE does this when one runs code from the editor, because it
> cannot/should not inject error messages into the editor buffer...
> AND it replaces the ^ with red highlighting of the code pointed to.  No
> information is lost.  Apparently, some beginners do not see the
> connection between the SyntaxError box and the red highlighting.

Some people may not even be able to distinguish red from other colours. Those 
with red-green colourblindness will probably see the red as a sort of muddy 
brown that hardly stands out as different from usual black text.

http://wearecolorblind.com/

One should never use colour alone as the only indicator of status.

http://stackoverflow.com/questions/1498669/gui-design-for-color-blindness

http://davemeeker.com/color-blind-considerations-for-ui-design/


> I
> think I should add something to the box.  Maybe 'The error was detected
> at the point of the red highlighting.'


I just tested the REPL in idle for 2.7.4, and I get this:

>>> print Hello World
SyntaxError: invalid syntax


where "print" is green text on a white background, and "World" is black text on 
a red background. That may be unfriendly to the colourblind, and makes coping 
and pasting the error less helpful. I suggest:

- check the colours in a colourblindness simulator, and pay attention to the 
contrast; is the text still clear?

- include the ^ caret as the primary status indicator, delegating colour to 
secondary; this makes errors in IDLE a little more like the same experience in 
the standard REPL.


If I open a Python file containing:

print Hello World

and choose "Check Module", IDLE highlights the word "World" in red and displays 
a dialog showing:

There's an error in your program:
invalid syntax

Suggestion:

Change the dialog box to display a read-only text field showing the traceback:

  File "idletest.py", line 1
print Hello World
^
SyntaxError: invalid syntax


and add a button "Copy traceback" to allow the user to copy the text of the 
traceback and paste it into an email.

(Strictly speaking, the Copy button is redundant if the user can select the 
text in the field, but beginners may not realise the text can be selected.)



>> Instead, save your script (if you haven't yet) as a file
>> (whatever.py).
>>
>> Open a command line interpreter/shell.
>>
>> Navigate (cd ...) to where you saved the file
>>
>> Type "python whatever.py"
> 
> What a nuisance.

*shrug* If you're a Linux user, chances are you already have a shell open and 
ready to go. And with tab completion, you don't have to type as much as you 
might think. It just becomes second nature after a while.

I type something like "pypathwhat" and the shell will 
autocomplete directory and filenames.

Anyway, this isn't an argument over which is better, IDLE or the system 
terminal. They both have their advantages and disadvantages, and in practice 
the real answer to "which is better?" is always "whichever one you are used 
to".



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

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


[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Gary E. Miller

Gary E. Miller added the comment:

> The docs are clear that System Random uses os.urandom() for creating random 
> numbers, that there is not state, that sequences aren't reproducible, and 
> that seed method has no effect and is ignored.  

Agreed, but not relevant. I have anecdotal proof that the docs are not clear to 
a number of talented Python programmers that the seed parameter is not used.  
Or that the seed parameter is passed to the seed() method (and thus unused).

Disappointing...

--

___
Python tracker 

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



[issue29164] make test always fail at 218/405 ( AssertionError: ', ' not found in '1234.5' )

2017-01-04 Thread OO O

New submission from OO O:

make test always fail at 218/405
at test_format.py line 426

message:

[218/405/1] test test_format failed -- Traceback (most recent call last):
  File "/home/vm00/Downloads/Python-3.6.0/Lib/test/test_format.py", line 426, 
in test_locale
self.assertIn(sep, text)
AssertionError: ',' not found in '1234.5'

--
components: Installation
messages: 284692
nosy: OO O
priority: normal
severity: normal
status: open
title: make test always fail at 218/405 ( AssertionError: ',' not found in 
'1234.5' )
versions: Python 3.6

___
Python tracker 

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



[issue29152] unittest subTest does not call addFailure

2017-01-04 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report. That's because TestResult.addSubTest() updates 
TestResult.errors and TestResult.failures itself instead of calling the 
addError() and addFailure() methods respectively:

if issubclass(err[0], test.failureException):
errors = self.failures
else:
errors = self.errors
errors.append((subtest, self._exc_info_to_string(err, test)))

I don't know whether it was intentional or not so I'm adding Antoine to nosy 
list.

(I removed 3.4 from the versions field because it's in security-fix-only mode.)

--
components: +Library (Lib) -Tests
nosy: +berker.peksag, pitrou
stage:  -> test needed
type:  -> behavior
versions: +Python 3.6, Python 3.7 -Python 3.4

___
Python tracker 

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



[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thank you for the submission.  I respect what you're trying to do, but disagree 
that there is any issue here.   The docs are clear that System Random uses 
os.urandom() for creating random numbers, that there is not state, that 
sequences aren't reproducible, and that seed method has no effect and is 
ignored.  Also, the square brackets on the seed argument is our traditional way 
of saying that an argument is optional.

Apologies, but I'm going to close this.  IMO, the proposed wording is less 
clear and doesn't really help if someone is already misunderstanding what 
SystemRandom is all about and is imagining that the "seed" argument has some 
effect when the seed method is documented as being ignored.

--
status: open -> closed

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Inada,

Can you explain what your patch does?  I don't understand why you single out 
the OverflowError.  When is __index__ expected to raise it?

>>> (2**300).__index__()
2037035976334486086268445688409378161051468393665936250636140449354381299763336706183397376

--

___
Python tracker 

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



[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Gary E. Miller

Gary E. Miller added the comment:

Is there a better place to submit documentation problems to?  After my 
programming team spends a lot of valuable time figuring what the Python doc 
failed to mention I would like this knowledge to be put to good use by others.  
Paying it forward if you will.

--

___
Python tracker 

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



[issue29157] random.c: Prefer getrandom() over getentropy(), handle ENOSYS in py_getentropy()

2017-01-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Aside from a couple of outdated comments and the EPERM question, the attached 
patch looks good to me.

Regarding EPERM, I think it would make sense to make py_getrandom and 
py_getentropy handle that consistently, otherwise I can see future maintainers 
readily getting confused by the discrepancy.

--

___
Python tracker 

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



[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Gary E. Miller

Gary E. Miller added the comment:

> > why have an ignored parameter that is not plainly documented as ignored.

> Because it improves the substitutability of one RNG for another (i.e. the 
> same reason that we even have a seed() method).

I understand why it the parameter it there.  I think the parameter should stay 
there.  I am all for orthogonal functions.  It just needs to be documented that 
the parameter is ignored by SystemRandom().

Programmers are being misled by the online documentation and adding a seed 
parameter when it does nothing.

I should not have to read the library code to find out that a parameter is 
ignored.

--

___
Python tracker 

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



[issue29157] random.c: Prefer getrandom() over getentropy(), handle ENOSYS in py_getentropy()

2017-01-04 Thread Nick Coghlan

Changes by Nick Coghlan :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue29163] shlex error in posix mode and empty quotes

2017-01-04 Thread Michal Ostrowski

Changes by Michal Ostrowski :


--
components: +Library (Lib)
type:  -> behavior
versions: +Python 2.7, Python 3.4

___
Python tracker 

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



[issue29163] shlex error in posix mode and empty quotes

2017-01-04 Thread Michal Ostrowski

New submission from Michal Ostrowski:

Three examples below.  I believe the second is wrong, because it reorders
the "echo" and "," tokens.

>>> list(shlex.shlex('echo b="a",echo bar', posix=True))
['echo', 'b', '=', 'a', ',', 'echo', 'bar']
>>> list(shlex.shlex('echo b="",echo bar', posix=True))
['echo', 'b', '=', 'echo', ',', 'bar']
>>> list(shlex.shlex('echo b="",echo bar'))
['echo', 'b', '=', '""', ',', 'echo', 'bar']

--
messages: 284685
nosy: Michal Ostrowski
priority: normal
severity: normal
status: open
title: shlex error in posix mode and empty quotes

___
Python tracker 

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



[issue29162] pyshell.py: name 'sys' is not defined

2017-01-04 Thread OO O

New submission from OO O:

Sorry for my bad English.

line 7, 13 at pyshell.py.
Call sys befor import sys.
Cause name 'sys' is not defined

--
assignee: terry.reedy
components: IDLE
messages: 284684
nosy: OO O, terry.reedy
priority: normal
severity: normal
status: open
title: pyshell.py: name 'sys' is not defined
type: crash
versions: Python 3.6

___
Python tracker 

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



[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> why have an ignored parameter that is not plainly documented as ignored.

Because it improves the substitutability of one RNG for another (i.e. the same 
reason that we even have a seed() method).

--
priority: normal -> low
resolution:  -> not a bug

___
Python tracker 

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



[issue29148] Inheritance behaviour ambiguos

2017-01-04 Thread Berker Peksag

Berker Peksag added the comment:

You may find Raymond Hettinger's "super() considered super" article helpful to 
understand how Python's super() works: 
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/

--
nosy: +berker.peksag

___
Python tracker 

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



[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Gary E. Miller

Gary E. Miller added the comment:

I would change:

"Accordingly, the seed() method has no effect and is ignored."

To:

"Accordingly, the optional seed parameter and the seed() method have no effect 
and are ignored."

It was not obvious to me that the seed paramrter got passed to the seed() 
method and was then ignored.  After all, why have an ignored parameter that is 
not plainly documented as ignored.

--

___
Python tracker 

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



Re: Clickable hyperlinks

2017-01-04 Thread Michael Torrie
On 01/04/2017 03:58 PM, Deborah Swanson wrote:
> Thank you, thank you! Finally, at least one person on this list knows
> about something (anything) in the python world that is internet aware.
> It's also occurred to me that Beautifulsoup downloads data from a url,
> so that code must have access to some kind of an internet engine too.

Except that you never mentioned anything about this in your posts
before. It seemed to me you were asking about printing out clickable
hyperlinks with python.  Calling the OS to launch a browser to view a
url is a different beast which is why no one mentioned it before.

If you don't tell us what you're actually trying to do (your end goal),
things are more frustrating for everyone.  If you had said early on you
just want to be able to send the user to a particular url in a web
browser, what Chris suggested would have been said a long time ago,
rather than focusing on console output which is what you were asking
about and focusing attention on.

Just so you know, BeautifulSoup does not do any internet access itself;
it's only an HTML parser. You have to fetch web pages using something
like python's urllib and then feed the data to BeautifulSoup.  urllib is
not a web browser though.  It can pretend to be a browser as far as the
server is concerned but it knows nothing about javascript or rendering.
It just retrieves bytes which you can then feed to BeautifulSoup or some
other parser.

> Yes, I'd gotten as far as figuring out that you don't need a clickable
> link. Code that opens a url in a browse would do the job just fine. 

Good! I just wish you would have mentioned this much earlier as your end
goal.

> Or the webbrowser.open("http://.../;) in a Linux terminal you suggest.
> (I just have to get my Linux machine up and running again to try it.)

The webbrowser module does not require console or terminal output. It
will work on Windows or Linux if I'm not mistaken.  It asks the OS to
launch the default browser and load the indicated url.

> All in all, given that clickable urls in a console is a non-starter,
> this hits the nail on the head. Many thanks again!


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


[issue29159] Regression in bytes constructor

2017-01-04 Thread INADA Naoki

Changes by INADA Naoki :


--
keywords: +patch
Added file: http://bugs.python.org/file46147/29159-index-fallback.patch

___
Python tracker 

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



[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

>From the docs at 
>https://docs.python.org/3/library/random.html#alternative-generator :

"""
class random.SystemRandom([seed])
Class that uses the os.urandom() function for generating random numbers from 
sources provided by the operating system. Not available on all systems. Does 
not rely on software state, and sequences are not reproducible. Accordingly, 
the seed() method has no effect and is ignored. The getstate() and setstate() 
methods raise NotImplementedError if called.
"""

What is it that you think needs to be added or changed?

--

___
Python tracker 

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



[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



RE: Clickable hyperlinks

2017-01-04 Thread Deborah Swanson
D'Arcy Cain wrote, on Wednesday, January 04, 2017 5:03 AM
> 
> Deborah - please trim your quoted text.

Yes, I will. Some lists want to have it all to review in one message,
some want it trimmed to just the lines you are responding to. I was just
waiting to see what this list wants.
 
> On 2017-01-04 04:32 AM, Deborah Swanson wrote:

 
> > But we aren't trying to print strings here, the point is to produce 
> > clickable links. I didn't enclose them with quotes because I didn't 
> > see any point in printing plain text when I wanted 
> clickable links. I
> 
> I'm not sure what your links are composed of but mine all look like 
> sequences of characters or "strings."  It sounds like you are 
> trying to 
> make URL a first class type like strings. integers, floats, etc.  I 
> can't think of any language that treats URLs as first class objects. 
> Even HTML needs quotes:
> 
>http://...;>Go here
 
It seemed reasonable that you might be able to print urls, which is why
I tried the experiment with all of Steven's suggested formats. But I was
highly skeptical that any would work without some kind of modifiers to a
bare print statement.

> > actually didn't understand why you thought I should print 
> them, but it
> 
> You want to output them to something.  That often involves 
> printing them 
> to a particular handler.

Yes, that's one of the things I would expect if we could print them.

> > never would have occurred to me that you wanted me to print out a 
> > bunch of silly plain text strings, apparently just for the 
> heck of it.
> 
> Is that really what you got from his message?

Please forgive me, and I hope Steven forgives me too, but I was sick to
death of all the beating on a dead horse (using Python to make clickable
links in a console, any console). I'd taken heart when he first
suggested his print experiment, because it was a plausible approach. But
I lost my temper when he upbraided me in this message for failing to
enclose my strings in quotes, in a most patronizing kind of way, when
printing out plain text was absolutely nowhere on the progress toward a
solution scale. I've been quite impressed with Steven's knowledge and
talent, and after fending off the throng of unseeing naysayers all
afternoon, it was just a little too much. I really should have closed my
email reader hours before I read and replied to this message. Shoulda,
coulda, woulda.
 


> I can assure you that FF prints the string at some point.  It 
> may wrap 
> it in HTML tags first but printing is what it does.  Also, 
> the URLs are 
> stored as strings.  SQLite has no URL type.  If it did then it would 
> still store it as a string somewhere.  PostGreSQL would let 
> you create a 
> URL type if you wanted but you would still need to wrap it in quotes 
> (single in this case) when you created the entry.

I have no doubt that some variant of printing is involved. Transporting
urls to the internet is an output process. FF's sqlite implementation
does store urls as a text field in at least 2 tables. I would be
interested in how FF takes those text urls and opens web pages with
them, although I've learned and figured out just today some ways that
Python can also do it. Turns out clickable links were a red herring.

If Steven's original suggestion included anything but a bare print
statement, like the use of a special specifier or linking the print
statement to some module, the use of quoted strings would have at least
been worthy of consideration. But we all know what
print("http://www.wherever.com;) would print, and it would be utterly
worthless for the purpose at hand. Trying the print statement without
the quotes was a least a possibility, if there was any awareness in the
print code of urls and what to do with them. That was the whole point of
this fishing expedition, as I saw it. To see if there was any
undocumented or narrowly known-of features in the print code.


> In all the messages in this thread I still don't understand what this 
> "teensy advantage" is supposed to be.  Do you want to be able 
> to do this:
> 
>make_web_link(http://...)
> 
> instead of:
> 
>make_web_link("http://...;)
> 
> -- 
> D'Arcy J.M. Cain
> System Administrator, Vex.Net
> http://www.Vex.Net/ IM:da...@vex.net
> VoIP: sip:da...@vex.net

You probably didn't see my oneliner on the "why do it" part in the swarm
of messages on this thread yesterday. In it I mentioned that the use
would be to open urls in the data I'm working with while I'm debugging
the code that uses them. I want to see what pages they open, without
having to leave my IDE. (Obviously I'd have to open another .py file,
but that would be easier and quicker than the alternatives.) I never
intended my original question to be any more than a frivolous toss out
into the sea, to see if anyone knew an answer. I was flat out astonished
when it blew up into the mini-monster that it did. 

Is make_web_link("http://...;) valid python code? That's exactly the
kind of answer I was 

MySQL schema sync or diff

2017-01-04 Thread Charles Heizer
Hello,
I have a MySQL database that is not managed (yet) and I would like to get an 
output or diff against my new model file. I'm using flask-sqlalchemy. 

Are there any modules that would help me discover the differences so that I can 
script a migration to begin using flask-migrate?

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


[issue29160] pow with three int arguments works like it had two arguments

2017-01-04 Thread Case Van Horsen

Case Van Horsen added the comment:

This is a bug/limitation in numpy. If x and y are Python integers, and type(z) 
is of another numeric type, pow calls the nb_power slot of the underlying type. 
Here a quick example using numpy.int32 and gmpy2.mpz:

>>> import numpy, gmpy2
>>> pow(11,13,7)
4
>>> pow(11,13,numpy.int32(7))
34522712143931
>>> pow(11,13,gmpy2.mpz(7))
mpz(4)


>>> (11).__pow__(13,7)
4
>>> numpy.int32(11).__pow__(13,7)
34522712143931
>>> gmpy2.mpz(11).__pow__(13,7)
mpz(4)


casevh

--
nosy: +casevh

___
Python tracker 

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



Re: Clickable hyperlinks

2017-01-04 Thread Terry Reedy

On 1/4/2017 4:32 AM, Deborah Swanson wrote:


My original question was whether python had anything to provide this
functionality, and the answer appears to be a resounding NO!!!


I would say 'Yes, but with user effort'.

To have a string interpreted as a clickable link, you send the string to 
software capable of creating a clickable link, plus the information 
'this is a clickable link'*.  There are two ways to tag a string as a 
link.  One is to use markup around the url in the string itself. 
'' and html are example.  Python provides multiple to make this 
easy. The other is to tag the string with a separate argument.  Python 
provides tkinter, which wraps tk Text widgets, which have a powerful tag 
system.  One can define a Link tag that will a) cause text to be 
displayed, for instance, blue and underlined and b) cause clicks on the 
text to generate a web request.  One could then use

  mytext.insert('insert', 'http://www.example.com', Link)
Browser must do something similar when they encounter when they 
encounter html link tags.


* If the software directly recognizes a bare url such as 
'http://www.example.com' as a link, without further indication, then it 
should have a way to disable conversion to a clickable link.


--
Terry Jan Reedy

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


Re: Clickable hyperlinks

2017-01-04 Thread Chris Angelico
On Thu, Jan 5, 2017 at 9:58 AM, Deborah Swanson
 wrote:
> Chris Angelico wrote, on January 04, 2017 4:16 AM
>> This uses the 'webbrowser' module, which knows about a number
>> of different ways to open a browser, and will attempt them
>> all. So if you can figure out the UI part of things, actually
>> making the link pop up in a browser isn't too hard; for
>> instance, if you're doing OAuth at the command line and need
>> the user to go and authenticate, you can simply
>> webbrowser.open("http://.../;) and it'll DTRT.
>>
>
> Thank you, thank you! Finally, at least one person on this list knows
> about something (anything) in the python world that is internet aware.
> It's also occurred to me that Beautifulsoup downloads data from a url,
> so that code must have access to some kind of an internet engine too.

We've been all talking at cross purposes a bit in this thread. Most of
us thought you were talking about the *user interface* of a clickable
link, but if you're talking about the *mechanics* of HTTP downloads,
Python has excellent facilities. I'd recommend checking out the
third-party 'requests' module on PyPI.

> I googled antigravity and found a number of interesting links.
>
> The History of Python: import antigravity
> http://python-history.blogspot.com/2010/06/import-antigravity.html
>
> Among other things, it was added to Python 3 in 2010, so it's been
> around a little while. And a comment mentions that "The antigravity
> module is also included in Python 2.7."
>
> And a reddit poster tells us that "if you type 'import antigravity' into
> a Python command line your default browser opens the XKCD comic 'Python'
> in a tab."
> https://www.reddit.com/r/ProgrammerHumor/comments/1hvb5n/til_if_you_type
> _import_antigravity_into_a_python/
>
> An "import antigravity" video at
> https://www.youtube.com/watch?v=_V0V6Rk6Fp4

Hehe, yeah. It's a big joke that started because XKCD mentioned the
language. But actually, the source code for antigravity.py itself
isn't significant; all it does is call on the webbrowser module:

https://docs.python.org/3/library/webbrowser.html

> Yes, I'd gotten as far as figuring out that you don't need a clickable
> link. Code that opens a url in a browse would do the job just fine. Or
> the webbrowser.open("http://.../;) in a Linux terminal you suggest.
> (I just have to get my Linux machine up and running again to try it.)
>
> All in all, given that clickable urls in a console is a non-starter,
> this hits the nail on the head. Many thanks again!

Cool! Glad I could help out a bit. There are a few different things
you can consider:

1) Open up a browser tab and let the user see the result
2) Make the request programmatically and access the text of the page
for further processing
3) Invoke a hidden web browser, browse to a URL, submit form data,
etc, as a means of testing a web server.

All three are possible. Take your pick!

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


[issue29161] random.SystemRandom(seed) documentation issue

2017-01-04 Thread Gary E. Miller

New submission from Gary E. Miller:

The man page for random.SystemRandom([seed]]) fails to mention that the 
parameter 'seed' is never used.  This should be prominent in the documentation. 
 I have found several cases where a seed was provided to SystemRandom().

https://docs.python.org/2.7/library/random.html?highlight=systemrandom

Present in all versions of Python docs that I could find.

--
components: Library (Lib)
messages: 284678
nosy: gem
priority: normal
severity: normal
status: open
title: random.SystemRandom(seed) documentation issue
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, 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



[issue29023] Results of random.seed() call with integer argument should be claimed deterministic.

2017-01-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The wording can perhaps be made more precise.  However, this needs to be the 
end of this series of tracker items which are turning into time wasters.

--
assignee: docs@python -> rhettinger
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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



[issue29160] pow with three int arguments works like it had two arguments

2017-01-04 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
components: +Interpreter Core -Distutils
title: `pow` with three int arguments works like it had two arguments -> pow 
with three int arguments works like it had two arguments

___
Python tracker 

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



Re: Hey, I'm new to python so don't judge.

2017-01-04 Thread Terry Reedy

On 1/3/2017 10:15 PM, Dennis Lee Bieber wrote:


And that statement tells us you are trying to run from within some
IDE/editor which is trapping Python exceptions and producing a dialog
box for them.


IDLE does this when one runs code from the editor, because it 
cannot/should not inject error messages into the editor buffer...
AND it replaces the ^ with red highlighting of the code pointed to.  No 
information is lost.  Apparently, some beginners do not see the 
connection between the SyntaxError box and the red highlighting.  I 
think I should add something to the box.  Maybe 'The error was detected 
at the point of the red highlighting.'



Instead, save your script (if you haven't yet) as a file
(whatever.py).

Open a command line interpreter/shell.

Navigate (cd ...) to where you saved the file

Type "python whatever.py"


What a nuisance.


Copy and paste the results of the CLI/Shell window.


Or one can hit F5 to run the code or Alt-X to just check the syntax.
A beginner should do this every few lines, and it should be as easy as 
possible to check.  If one needs to ask about a syntax error, one can 
copy the code up and including the highlighted part. Example:


"When I run this code in IDLE

def is_same(target, number:
if

I get a SyntaxError at 'if'."

If the OP had known to do this, the error might have been seen without 
posting.


--
Terry Jan Reedy

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


[issue29160] `pow` with three int arguments works like it had two arguments

2017-01-04 Thread Benjamin Pollak

Benjamin Pollak added the comment:

I tried running your script, but it crashes on the last two lines (variables n2 
and n1 appear to be undefined). Could you please update that script so we can 
have a better idea of the behavior of your bug?

Thanks,
BP

--
nosy: +Benjamin Pollak

___
Python tracker 

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



Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread William Ray Wing

> On Jan 4, 2017, at 3:44 PM, Dietmar Schwertberger  
> wrote:
> 
> On 04.01.2017 15:41, William Ray Wing wrote:
>> I use Wing, and I think you will like it.  It *is* pythonic, and for what it 
>> is worth, offers remote debugging as one of its more recently added features.
> Obviously, you had no other choice than using Wing ;-)

I should have said something.  First, and to the best of my knowledge, I have 
no relationship with the Wing developers other than being a satisfied customer. 
Second, seven years ago, when I was reading IDE reviews and testing the more 
highly rated products, Wing just bubbled up to the top of the sieve I was using 
(features, ease of use, and the way it fit my idea of “natural”, pretty much 
everyone's standard list).

> 
> The remote debugging has been around for some years. I have been using it 
> quite often to debug on my Raspberry Pi, Nokia N900 and Jolla Phone, all 
> running some Linux system. It works well. It is or was a bit complicated to 
> set up. I think this has been improved with Wing 6, but I did not need it in 
> the last weeks, so I don't know.

They claim it has been, but like you, I haven’t had need to test it on the new 
release.

Thanks,
Bill

> 
> Regards,
> 
> Dietmar
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


RE: Clickable hyperlinks

2017-01-04 Thread Deborah Swanson
Chris Angelico wrote, on January 04, 2017 4:16 AM
> 
> On Wed, Jan 4, 2017 at 10:43 PM, Deborah Swanson 
>  wrote:
> > I'm quite well aware by now that there is no one-sentence 
> answer to my 
> > original question, if there's any coherent answer at all. 
> Them's the 
> > breaks. Live with it or live without it, it doesn't care.
> 
> Yeah, there's no simple answer; however, you'll find that 
> Python on many platforms is entirely capable of popping a URL 
> up in the user's default browser. Check this out:
> 
> >>> import antigravity
> 
> This uses the 'webbrowser' module, which knows about a number 
> of different ways to open a browser, and will attempt them 
> all. So if you can figure out the UI part of things, actually 
> making the link pop up in a browser isn't too hard; for 
> instance, if you're doing OAuth at the command line and need 
> the user to go and authenticate, you can simply 
> webbrowser.open("http://.../;) and it'll DTRT.
> 

Thank you, thank you! Finally, at least one person on this list knows
about something (anything) in the python world that is internet aware.
It's also occurred to me that Beautifulsoup downloads data from a url,
so that code must have access to some kind of an internet engine too.

I googled antigravity and found a number of interesting links. 

The History of Python: import antigravity
http://python-history.blogspot.com/2010/06/import-antigravity.html

Among other things, it was added to Python 3 in 2010, so it's been
around a little while. And a comment mentions that "The antigravity
module is also included in Python 2.7."

And a reddit poster tells us that "if you type 'import antigravity' into
a Python command line your default browser opens the XKCD comic 'Python'
in a tab."
https://www.reddit.com/r/ProgrammerHumor/comments/1hvb5n/til_if_you_type
_import_antigravity_into_a_python/

An "import antigravity" video at
https://www.youtube.com/watch?v=_V0V6Rk6Fp4

And its page in the Package Index:
https://pypi.python.org/pypi/antigravity/0.1, with a Page Not Found
Error for the Home Page. So it doesn't look like there's any alternative
but to download it and look at the code.

Yes, I'd gotten as far as figuring out that you don't need a clickable
link. Code that opens a url in a browse would do the job just fine. Or
the webbrowser.open("http://.../;) in a Linux terminal you suggest.
(I just have to get my Linux machine up and running again to try it.)

All in all, given that clickable urls in a console is a non-starter,
this hits the nail on the head. Many thanks again!

Deborah


   

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


[issue29160] `pow` with three int arguments works like it had two arguments

2017-01-04 Thread Pavel Chuvakhov

New submission from Pavel Chuvakhov:

Standard `pow` function of three integer arguments should result in a reminder 
`(x**y) % z`. It seems that `pow(x,y,z)` ignores `%z` operation if type(z) is 
not `int`. This happens also in the cases when `z` has type numpy.int32, 
numpy.int64, etc. I consider such a behavior of `pow` as a bug to be fixed.

Thank you for your attantion, guys!
Best wishes, Pavel.

--
components: Distutils
files: pow-bug_report.py
messages: 284675
nosy: dstufft, eric.araujo, pch
priority: normal
severity: normal
status: open
title: `pow` with three int arguments works like it had two arguments
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file46146/pow-bug_report.py

___
Python tracker 

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



Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread Hans-Peter Jansen
On Montag, 2. Januar 2017 03:38:53 Antonio Caminero Garcia wrote:
> Hello, I am having a hard time deciding what IDE or IDE-like code editor
> should I use. This can be overwhelming.
> 
> So far, I have used Vim, Sublime, Atom, Eclipse with PyDev, Pycharm,
> IntelliJ with Python plugin.

Well, since nobody mentioned it, yet: eric is doing quite nice here.
With on the fly error checking, jedi and qscintilla calltips and 
autocompletion, git integration (using a plugin), graphical debugger, it's 
grown to a capable IDE over the years.

Given, it's a fully open source, PyQt based project, it also shows the powers 
of Python3 and PyQt.

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


[issue29158] Possible glitch in the interaction of a thread and a multiprocessing manager

2017-01-04 Thread Davin Potts

Davin Potts added the comment:

There are too many things going on in this example -- it would be far easier to 
digest if the example could be simplified.

The general programming rule of thumb (completely unrelated to but still just 
as relevant to Python) that I think David might have been invoking is:  create 
processes first then create threads inside of them.  Otherwise, if you fork a 
process that has multiple threads going inside it, you should expect problems.  
Assuming you're on a unix platform, it looks like you're creating threads then 
forking a process as well as doing it the other way around in another part of 
your code.

Different topic:  you mention killing the main process for server.py... which 
would likely kill the manager process referred to by shared_objects_manager... 
but you're creating a different manager process in bridge.py that is told to 
listen on the same port...


Without pulling apart your code further, I suspect confusion over how to use a 
Manager to share objects / data / information across processes.  If it helps, 
generally one process creates a manager instance (which itself results in the 
creation of a new process) and then other processes / threads created are 
created by that first process and given a handle on the manager instance or the 
objects managed by that manager.  I am a bit confused by your example but I 
hope that explanation helps provide some clarity?

--
nosy: +davin

___
Python tracker 

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



Work between multiple processes

2017-01-04 Thread zxpatric
Hi everyone,

I ran into a case that I need to create a work process of an application 
(Jython so has to call using java.exe) which will collect the data based on 
what main process indicates. 

(1) I tried multiprocessing package, no luck. Java.exe can't be called from 
Process class?

(2) I tried subprocess. subprocess.communicate function will wait for the work 
process to terminate so to return.

 
either (1) or (2) doesn't work out well. Please suggest.  Global system queue?

Thanks,
Patrick.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29021] Custom functions in sqlite receive None on invalid UTF-8

2017-01-04 Thread Aviv Palivoda

Aviv Palivoda added the comment:

The problem is in _pysqlite_build_py_params function at connection.c. In case 
we have text we do the following code:

case SQLITE_TEXT:
  val_str = (const char*)sqlite3_value_text(cur_value);
  cur_py_value = PyUnicode_FromString(val_str);
  /* TODO: have a way to show errors here */
  if (!cur_py_value) {
 PyErr_Clear();
 Py_INCREF(Py_None);
 cur_py_value = Py_None;
  }
  break;

As you can see we call PyUnicode_FromString instead of text_factory.

I started making a patch to fix this by passing the text_factory to 
_pysqlite_build_py_params function but I currently have a problem with setting 
the result to the sqlite. User text_factory may return any type of object and I 
can't see how to handle that...

--
nosy: +palaviv

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Also relevant:

  * #20895 - Add bytes.empty_buffer and deprecate bytes(17) for the same purpose
  * PEP 467 - Minor API improvements for binary sequences

--

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I don't think we should put too much effort into preserving numpy behavior.  
Consider this python 3.5 session:

>>> import numpy
>>> a = numpy.array([1])
>>> bytes(a)
__main__:1: VisibleDeprecationWarning: converting an array with ndim > 0 to an 
index will result in an error in the future
b'\x00'
>>> a = numpy.array([2, 2])
>>> bytes(a)
b'\x02\x00\x00\x00\x02\x00\x00\x00'

It looks like this behavior is just an artifact of ndarray providing both 
__index__ and buffer protocol and not something thought out by numpy developers.

I wonder if we could check for buffer protocol support before detecting an 
integer argument?  I also recall a discussion of deprecating bytes(int) 
altogether.  See 
.

--

___
Python tracker 

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



Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread Dietmar Schwertberger

On 04.01.2017 15:41, William Ray Wing wrote:

I use Wing, and I think you will like it.  It *is* pythonic, and for what it is 
worth, offers remote debugging as one of its more recently added features.

Obviously, you had no other choice than using Wing ;-)

The remote debugging has been around for some years. I have been using 
it quite often to debug on my Raspberry Pi, Nokia N900 and Jolla Phone, 
all running some Linux system. It works well. It is or was a bit 
complicated to set up. I think this has been improved with Wing 6, but I 
did not need it in the last weeks, so I don't know.


Regards,

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


Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread Dietmar Schwertberger

On 04.01.2017 07:54, Antonio Caminero Garcia wrote:

Unfortunately most of the time I am still using print and input functions. I 
know that sucks, I did not use the pdb module, I guess that IDE debuggers 
leverage such module.
pdb is actually quite useful. On my Windows PCs I can invoke python on 
any .py file with the -i command line switch by right clicking in the 
Explorer and selecting "Debug". Now when the script crashes, I can 
inspect variables without launching a full-scale IDE or starting the 
script from the command line. For such quick fixes I have also a context 
menu entry "Edit" for editing with Pythonwin, which is still quite OK as 
editor and has no licensing restrictions or installation requirements. 
This is a nice option when you deploy your installation to many PCs over 
the network.


For the print functions vs. debugger:
The most useful application for a debugger like Wing is not for 
bug-fixing, but to set a break point and then interactively develop on 
the debugger console and with the IDE editor's autocompletion using 
introspection on the live objects. This is very helpful for hardware 
interfacing, network protocols or GUI programs. It really boosted my 
productivity in a way I could not believe before. This is something most 
people forget when they evaluate programming languages. It's not the 
language or syntax that counts, but the overall environment. Probably 
the only other really interactive language and environment is Forth.



If it happens to be Arduino I normally use a sublime plugin called Stino
https://github.com/Robot-Will/Stino
(1337 people starred that cool number :D)

Well, it is CodeWarrior which was quite famous at the time of the 68k Macs.
The company was bought by Motorola and the IDE is still around for 
Freescale/NXP/Qualcomm microcontrollers like the HCS08 8 bit series. 
Around ten years ago the original CodeWarrior IDE was migrated to 
something Eclipse based.
When I last evaluated HCS08 vs. Arduino, the HCS08 won due to the better 
debug interface and native USB support. HCS08 is still quite cool, but 
when it comes to documentation, learning curve, tools etc. the Arduinos 
win



Regards,

Dietmar

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


[issue29070] Integration tests for pty.spawn on Linux and all other platforms

2017-01-04 Thread Martin Panter

Martin Panter added the comment:

Ignore my comment about contrib agreement, that must have come through recently 
:)

--

___
Python tracker 

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



[issue29070] Integration tests for pty.spawn on Linux and all other platforms

2017-01-04 Thread Martin Panter

Martin Panter added the comment:

Hi Cornelius and thanks for the work. Since the patch adds a significant amount 
of code, I think you might have to sign the contributor agreement: 
. You can do it in a web 
browser.

I would like to review your tests, but because there is a lot of code to 
understand and I don’t have much time, it might take me a while. If you can 
find any way to simplify it, that would be great.

I have some comments on the code review, and will probably post more as I begin 
to understand what you are proposing.

It looks like you depend on fixing Issue 26228, but the patch there will 
conflict with your changes. Maybe merge with the other patch, or propose an 
alternative fix.

The documentation currently mentions the code is only tested on Linux, so it 
would be nice to update that.

The patch does introduce behavioural changes, if you consider abuse like 
monkey-patching os.exec() after importing the pty module. It is best not to 
make unnecessary changes in a bug fix.

Why does the patch slow the tests down so much? Ideally, it is nice to keep the 
tests as fast as possible.

What is the problem with using a genuine exec() call? Why do we need 
PtyMockingExecTestBase?

--
versions: +Python 2.7, Python 3.5

___
Python tracker 

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



[issue26851] android compilation and link flags

2017-01-04 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Latest patch committed with the following simplification: BASECFLAGS and 
LDFLAGS are now set for armv7 at the same place, as suggested by Martin in 
msg271518.

--
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



[issue26851] android compilation and link flags

2017-01-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fa2bc63e64c6 by Xavier de Gaye in branch '3.6':
Issue #26851: Set Android compilation and link flags.
https://hg.python.org/cpython/rev/fa2bc63e64c6

New changeset af363b5200ff by Xavier de Gaye in branch 'default':
Issue #26851: Merge 3.6.
https://hg.python.org/cpython/rev/af363b5200ff

--
nosy: +python-dev

___
Python tracker 

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



[issue26851] android compilation and link flags

2017-01-04 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
versions: +Python 3.6

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, if numpy arrays are affected, this should be restored. But swallowing an 
arbitrary exception doesn't look good to me.

--

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Indeed, there is behavior change. It is easy to revert the old behavior. But 
was the old behavior designed? It looks as a side effect of the implementation.

What is a reason of making an array an integer type?

--

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

My test code may seem contrived, but numpy arrays exhibit similar behavior:

>>> a = numpy.array([2, 2])
>>> bytes(a)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: only integer arrays with one element can be converted to an index

Under python 3.5, the result was

>>> bytes(a)
b'\x02\x00\x00\x00\x02\x00\x00\x00'

--

___
Python tracker 

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



[issue29159] Regression in bytes constructor

2017-01-04 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

Consider the following code:

$ cat bug.py
from array import array
class C(array):
def __new__(cls):
return array.__new__(cls, 'B', b'abc')
def __index__(self):
raise TypeError
x = C()
print(bytes(x))

It works under python 3.5:

$ python3.5 bug.py
b'abc'

but raises a TypeError under python 3.6:

$ python3.6 bug.py
Traceback (most recent call last):
  File "bug.py", line 8, in 
print(bytes(x))
  File "bug.py", line 6, in __index__
raise TypeError
TypeError

It looks like this was introduced in issue #27704.

(Ref: e/pyq#827)

--
keywords: 3.6regression
messages: 284663
nosy: belopolsky, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Regression in bytes constructor
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29158] Possible glitch in the interaction of a thread and a multiprocessing manager

2017-01-04 Thread R. David Murray

R. David Murray added the comment:

My understanding is that the basic rule of thumb is: don't mix threads and 
multiprocessing.  You may find that if you use spawn, it won't ever work.  But 
I haven't used multiprocessing myself.

--
nosy: +r.david.murray
type: crash -> behavior

___
Python tracker 

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



[issue29158] Possible glitch in the interaction of a thread and a multiprocessing manager

2017-01-04 Thread Luciano Dionisio

New submission from Luciano Dionisio:

After spending a lot of time trying to understand why my code will not execute 
as expected and after not getting any help from StackOverflow:

http://stackoverflow.com/questions/41444081/python-multiprocessing-manager-delegate-client-connection-and-dont-wait

I assumed that it may be a possible glitch in the interaction of a thread and a 
multiprocessing manager.

I have tried this in Python 2.7.13 and Python 3.6.0 and assume the problem 
still exists in between and beyond.

The problem appears when I try to delegate the connect() method of a 
multiprocessing manager client to a thread. The first time the procedure takes 
place, everything works fine and there is no problem of shared memory or 
anything. The problem arises on the second and forth trials of connect, when 
there seems to be a memory sharing problem. To reproduce the problem you have 
to run the server.py and client.py modules. You can see that the client is 
capable of populating the server's queue. If you terminate the server.py 
process and start it again, the client can no longer reassign the remote queue. 
Actually, reconnecting to the server always take place, as well as the correct 
linkage to the remote queue on line 53 of bridge.py:

self.items_buffer = self.remote_manager.items_buffer()

but the problem is that this procedure no longer works after the first time. 
Even though the connection is re-established, and at the moment of reconnection 
it is possible to send info to the server, whenever the thread dies, the pipe 
gets somehow broken.

--
components: Interpreter Core
files: case.zip
messages: 284661
nosy: Luciano Dionisio
priority: normal
severity: normal
status: open
title: Possible glitch in the interaction of a thread and a multiprocessing 
manager
type: crash
versions: Python 2.7, Python 3.6
Added file: http://bugs.python.org/file46145/case.zip

___
Python tracker 

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



Re: Screwing Up looping in Generator

2017-01-04 Thread Sayth Renshaw
For completeness I was close this is the working code.

def get_list_of_names(generator_arg):
name_set = set()
for name in generator_arg:
base = os.path.basename(name.name)
filename = os.path.splitext(base)[0]
name_set.add(filename)
return name_set


def data_attr(roots):
"""Get the root object and iter items."""
for name in names:
directory = "output"
write_name = name + ".csv"
with open(os.path.join(directory, write_name), 'w', newline='') as csvf:
race_writer = csv.writer(csvf, delimiter=','
)


thanks for your time and assistance. It's much appreciated

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


Re: Simulating int arithmetic with wrap-around

2017-01-04 Thread Rob Gaddi

On 01/03/2017 10:00 PM, Gregory Ewing wrote:

Paul Rubin wrote:

My first thought is towards the struct module, especially if you want to
handle a bunch of such integers at the same time.  Or maybe the array
module or some combination.


Or possibly numpy.



Agreed.  If you had to do a lot of calculations on arbitrary sized 
signed/unsigned ints, figuring how to parallelize them into numpy arrays 
would save you a ton of time.


--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list


[issue29157] random.c: Prefer getrandom() over getentropy(), handle ENOSYS in py_getentropy()

2017-01-04 Thread STINNER Victor

STINNER Victor added the comment:

Python 2.7, 3.5, 3.6 and 3.7 are impacted: they should fail on Linux if 
compiled with a recent glibc which has getentropy().

--

___
Python tracker 

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



  1   2   >