[issue34588] traceback formatting can drop a frame

2018-09-05 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Further investigation reveals this is a general off-by-one error with the 
recursive traceback pruning feature.

--
components: +Interpreter Core
title: traceback module can drop a frame -> traceback formatting can drop a 
frame

___
Python tracker 

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



[issue34594] Some tests use hardcoded errno values

2018-09-05 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue34594] Some tests use hardcoded errno values

2018-09-05 Thread Zackery Spytz


New submission from Zackery Spytz :

test_spwd.py and test_tabnanny.py use hardcoded errno values when they test 
some exception messages.

--
components: Tests
messages: 324662
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: Some tests use hardcoded errno values
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue34586] collections.ChainMap should have a get_where method

2018-09-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I haven't run across this requirement before but it does seem plausible that a 
person might want to know which underlying mapping found a match (compare with 
the "which" utility in Bash). On the other hand, we haven't had requests for 
anything like this for other lookup chains such as determining where a variable 
appears in the sequence locals-to-nested-scopes-to-globals-to-builtins.

Also, I'm not sure I like the proposed API (the method name and signature).  
Perhaps, this should be a docs recipe for a ChainMap subclass or be an example 
of a standalone search function that the takes the *maps* attribute as one of 
its arguments.  Will discuss this with the other core devs to get their 
thoughts.

--

___
Python tracker 

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



[issue34590] "Logging HOWTO" should share an example of best practices for using logging in a library

2018-09-05 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, I think the practices vary somewhat widely and that none of your 
questions have generally agreed upon answers.  Part of the reason that there 
are so many ways to go is that the package was modeled after Java APIs where 
the practices and needs were also widely varied.  Given the absence of 
clear-cut best practices, the docs should probably defer to StackOverflow and 
various blog posts.

--
nosy: +rhettinger

___
Python tracker 

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



Re: Any SML coders able to translate this to Python?

2018-09-05 Thread Marko Rauhamaa
Marko Rauhamaa  (Marko Rauhamaa):
> Steven D'Aprano :
>> I have this snippet of SML code which I'm trying to translate to Python:
>>
>> fun isqrt n = if n=0 then 0
>>  else let val r = isqrt (n/4)
>>   in
>> if n < (2*r+1)^2 then 2*r
>> else 2*r+1
>>   end
> [...]
> You must make sure "r" doesn't leak outside its syntactic context so:
>
> def isqrt(n):
> if n == 0:
> return 0
> else:
> def f2398478957():
> r = isqrt(n//4)
> if n < (2*r+1)**2:
> return 2*r
> else:
> return 2*r+1
> return f2398478957()

Actually, this is a more direct translation:

   def isqrt(n):
   if n == 0:
   return 0
   else:
   def f2398478957(r):
   if n < (2*r+1)**2:
   return 2*r
   else:
   return 2*r+1
   return f2398478957(isqrt(n//4))


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


[issue34566] pipe read sometimes returns EOF but returncode is still None

2018-09-05 Thread Martin Panter


Martin Panter  added the comment:

You probably only need to call "wait" once. That blocks the thread until it 
gets a result, so it is more CPU-efficient than calling "poll" in a busy loop.

Since you open a separate pipe for "stderr" in script.py, but don't do anything 
with it, there could be a deadlock with the child writing to the stderr pipe 
versus the parent reading from "stdout" or waiting for the exit status.

I guess your script is an approximation of the "sos" application. I don't have 
time to understand everything it is trying to do, but I added some comments at 
.

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



[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

2018-09-05 Thread hongweipeng


hongweipeng  added the comment:

Multi-process need uses multiprocessing.Manager to share, the current problem 
should be tee-objcet thread safety issue.As Xiang Zhang said,`PyIter_Next` in 
`teedataobject_getitem` releases GIL.So the thread lock is necessary,and only 
lead iterator uses it when runs `PyIter_Next`.Can anyone help me review it.

--
nosy: +hongweipeng

___
Python tracker 

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



[issue34410] itertools.tee not thread-safe; can segfault interpreter when wrapped iterator releases GIL

2018-09-05 Thread hongweipeng


Change by hongweipeng :


--
keywords: +patch
pull_requests: +8533
stage: needs patch -> patch review

___
Python tracker 

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



[issue34593] Missing inttypes.h

2018-09-05 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Python 3.6 requires a C compiler that supports C99. So, not MSVC 2012.

--
nosy: +benjamin.peterson
resolution:  -> wont fix
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



[issue34593] Missing inttypes.h

2018-09-05 Thread Gary Simpson


New submission from Gary Simpson :

I started with Anaconda3 (python3.64). When I add #include "python.h" to my C++ 
code, I get the visual studio 2012 compile error:
anaconda3\include\pyport.h(6): fatal error C1083: Cannot open include file: 
'inttypes.h': No such file or directory

I then installed python 3.7, and put that include directory into my project. 
But I get the same error when I try to compile. 
python.h calls pyport.h, which tries to call inttypes.h, which it can't find. I 
searched and cannot find inttypes.h anywhere on my computer.

--
messages: 324656
nosy: garyrsimpson
priority: normal
severity: normal
status: open
title: Missing inttypes.h
type: compile error
versions: Python 3.6, Python 3.7

___
Python tracker 

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



Re: Calling an unbound method in C using the Public API

2018-09-05 Thread Matthieu Dartiailh
Thanks Serhiy. This does come with a performance penalty (in particular for 
function taking keyword arguments) but this is to be expected. Also the 
PyList_Insert solution does not sadly work for all the methods that I need to 
wrap.

Best

Matthieu

> On Aug 30, 2018, at 11:09 AM, Serhiy Storchaka  wrote:
> 
> 29.08.18 17:33, Matthieu Dartiailh пише:
>> I tried to look at the public C API for a way to call an unbound method with 
>> a minimal cost (in term of speed and memory). It seems to me, but please 
>> correct me if I am wrong, that one cannot call a MethodDef using only the 
>> public API. To use the public C API, one has to use PyCFunction_Call (or a 
>> variant) that expect a PyCFunctionObject which binds a the MethodDef to an 
>> instance. In my case, to avoid creating a temporary PyCFunctionObject each 
>> time I call list.insert on my custom subclass instance, I have to store that 
>> PyCFunctionObject for each instance. But this means storing  7 
>> PyCFunctionObject per instance (one for each method of list I need to wrap). 
>> So I can either use the public API and increase the memory footprint or slow 
>> down the code by creating PyCFunctionObject for each call
>>  , or use large amount of the private API.
>> Am I missing something ?
> 
> In general, you need to cache the unbound method object, and call it with 
> self as the first argument.
> 
> list_insert = PyObject_GetAttrString((PyObject *)_Type, "insert");
> ...
> res = PyObject_CallFunctionObjArgs(list_insert, self, index, value, NULL);
> 
> But in the particular case of the insert method it will be easier and more 
> efficient to use PyList_Insert().
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


[issue34486] "RuntimeError: release unlocked lock" when starting a thread

2018-09-05 Thread Vladimir Matveev


Vladimir Matveev  added the comment:

I agree. From code in threading.Condition.wait looks like if it is interrupted 
either after calling _release_save and before entering try block or in finally 
block before calling _acquire_restore - it will leave the lock in non-acquired 
state. 

First part in theory can be solved if _release_save is moved into try block and 
instead of returning saved_state as a result it will accept reference to 
saved_state local and set it in C code.

Second part looks more interesting ... :)

--
nosy: +v2m

___
Python tracker 

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



Re: Re: CURSES WINDOWS

2018-09-05 Thread Peter via Python-list

I get this:


C:\Users\Me> py
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 
bit (Inte

l)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import curses
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Program Files (x86)\Python36-32\lib\curses\__init__.py", 
line 13, in


    from _curses import *
ModuleNotFoundError: No module named '_curses'
>>>


I get the same on py 2.7



On 5/09/2018 4:59 PM, Anssi Saari wrote:

shinobi@f153.n1.z21.fsxnet (shinobi) writes:


Hello All,

can anyone please let me know what's the path to port linux python curses
program to Windows?

Is there really anything that needs to be done? At least a simple hello
world python curses program runs on Windows and Linux with no changes.





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


[issue34592] cdll.LoadLibrary allows None as an argument

2018-09-05 Thread Sergei Lebedev


New submission from Sergei Lebedev :

LoadLibrary in Python 2.7 through 3.7 accepts None as an argument. I wonder if 
this has been allowed for a reason? If not, it should probably be changed to 
raise a TypeError instead.

>>> ctypes.cdll.LoadLibrary(None)


Interestingly, on Python 2.7 LoadLibrary explicitly mentions None as allowed in 
the error message:

>>> ctypes.cdll.LoadLibrary(42)
Traceback (most recent call last):
  File "", line 1, in 
  File "[...]/ctypes/__init__.py", line 444, in LoadLibrary
return self._dlltype(name)
  File "[...]/ctypes/__init__.py", line 366, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: dlopen() argument 1 must be string or None, not int

A side-effect of None being allowed is that chaining find_library and 
LoadLibrary is error-prone:

>>> ctypes.cdll.LoadLibrary(find_library("foobar"))


--
messages: 324654
nosy: superbobry
priority: normal
severity: normal
status: open
title: cdll.LoadLibrary allows None as an argument
versions: Python 2.7, 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



[issue34591] smtplib mixes RFC821 and RFC822 addresses

2018-09-05 Thread Quae Quack


New submission from Quae Quack :

smtplib.sendmsg is documented to take RFC822 addresses. and e.g. if the 
`to_addrs` argument isn't provided then it gets the To address directly from 
the headers (which is in RFC822 form).

However it then proceeds to use it as an RFC821 address and sends it over the 
SMTP connection. 
https://github.com/python/cpython/blob/874809ea389e6434787e773a6054a08e0b81f734/Lib/smtplib.py#L542

--
components: Library (Lib)
messages: 324653
nosy: Quae Quack
priority: normal
severity: normal
status: open
title: smtplib mixes RFC821 and RFC822 addresses
type: security

___
Python tracker 

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



[issue34590] "Logging HOWTO" should share an example of best practices for using logging in a library

2018-09-05 Thread Nathaniel Manista


New submission from Nathaniel Manista :

https://docs.python.org/3.8/howto/logging.html#configuring-logging-for-a-library
 is a bit too short and doesn't answer some questions that I have as a library 
author about the best ways to use logging in a library.

Should I make use of a single logger object in my library, multiple loggers in 
a tree, or multiple unrelated loggers? Since I have just one public module, I'm 
tempted to say that I should just use one logger object.

Should I present as part of my public API the name of the logger object(s) 
used? Probably - the documentation starts with "When developing a library which 
uses logging, you should take care to document how the library uses logging - 
for example, the names of loggers used.". But should I also include the logger 
objects in my API? If an application wants to reach my logger, why should they 
use "logging.getLogger()" rather than 
"my_library.LOGGER"?

Should I use my library's fully-qualified name as the name of its logger? This 
seems like a great idea because it's unlikely to bring up any new conflicts. Is 
it a best practice? Is there any better practice?

The "Configuring Logging for a Library" text could answer these questions, and 
maybe it should, but... I really think a toy library example that library 
authors could follow would also help a great deal.

--
assignee: docs@python
components: Documentation
messages: 324652
nosy: Nathaniel Manista, docs@python
priority: normal
severity: normal
status: open
title: "Logging HOWTO" should share an example of best practices for using 
logging in a library
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



Re: Hi I'm trying to get live data from stock using python , is it poss

2018-09-05 Thread Chris Angelico
On Thu, Sep 6, 2018 at 6:06 AM, Calvin Spealman  wrote:
> Please don't keep spamming this list with the same question, while you have
> not responded to any of the advice you've already been given.
>
> If you have specific trouble with any of that advice and need further help,
> please give details and ask new questions!
>

I don't think this was spamming the list with the same question; a
glitch somewhere in a netnews server appears to be re-posting some old
posts.

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


Re: Hi I'm trying to get live data from stock using python , is it poss

2018-09-05 Thread Calvin Spealman
Please don't keep spamming this list with the same question, while you have
not responded to any of the advice you've already been given.

If you have specific trouble with any of that advice and need further help,
please give details and ask new questions!

Good luck.

On Wed, Sep 5, 2018 at 4:02 PM alon najman  wrote:

> On Tuesday, September 4, 2018 at 7:21:31 PM UTC+3, alon@gmail.com
> wrote:
> > Hi ,
> > for example:
> > I want to know if AAPL is more than value 300 and if it does I want it to
> send to me mail with gmail :) . thanks for the help..
>
> im using python 2.7
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-09-05 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



PEP 8001 -- Python Governance Voting Process

2018-09-05 Thread Mark Lawrence
I believe that this https://www.python.org/dev/peps/pep-8001/ may be of
interest.

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

Mark Lawrence

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


Re: Cross platform mutex to prevent script running more than instance?

2018-09-05 Thread Cameron Simpson
On 03Sep2018 07:45, Malcolm Greene  wrote:
>Use case: Want to prevent 2+ instances of a script from running ...
>ideally in a cross platform manner. I've been researching this topic and
>am surprised how complicated this capability appears to be and how the
>diverse the solution set is. I've seen solutions ranging from using
>directories, named temporary files,  named sockets/pipes, etc. Is there
>any consensus on best practice here?

I like os.mkdir of a known directory name. This tends to be atomic and
forbidden when the name already exists, on all UNIX platforms, over remote
filesystems. And, I expect, likewise on Windows.

All the other modes like opening files O_EXCL etc tend to be platform specific
and not reliable over network filesystems.

And pid based approaches don't work cross machine, if that is an issue.

Cheers,
Cameron Simpson 

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


[issue34561] Replace list sorting merge_collapse()?

2018-09-05 Thread Koos Zevenhoven

Koos Zevenhoven  added the comment:

Haha ok. Cache optimization makes it pretty complicated to reason about true 
costs. Anyway, it’s not obvious to me even that the run lengths would need to 
be descending for best performace. I’m not even starting to think about how the 
merging order might affect galloping boosts on realistic data ;-). I didn’t get 
to that power thing at this point, but it looks like it’s unrelated to this 
consideration, except perhaps by chance. I might have time tonight to have a 
look at that. Surely we don’t want an algorithm that’s optimized for what they 
call ”Timsort drag” sequences in the literature ;-).

--

___
Python tracker 

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



[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-09-05 Thread STINNER Victor


New submission from STINNER Victor :

According to Nick Coghlan, author of the PEP 538, the C locale coercion should 
not be enabled by Py_Initialize() and Py_Main(), only by the python3 program.

Attached PR fix this issue.

--
components: Interpreter Core
messages: 324649
nosy: vstinner
priority: normal
severity: normal
status: open
title: Py_Initialize() and Py_Main() should not enable C locale coercion
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue34574] OrderedDict iterators are exhausted during pickling

2018-09-05 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

This would presumably be a side-effect of all generic pickling operations of 
iterators; figuring out what the iterator produces requires running out the 
iterator. You could special case it case-by-case, but that just makes the 
behavior unreliable/confusing; now some iterators pickle without being mutated, 
and others don't. Do you have a proposal to fix it? Is it something that needs 
to be fixed at all, when the option to pickle the original OrderedDict directly 
is there?

--
nosy: +josh.r

___
Python tracker 

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



Re: Verifying the integrity/lineage of a file

2018-09-05 Thread Grant Edwards
On 2018-09-01, Peter Pearson  wrote:

> Writing your own crypto software is fraught with peril, and that
> includes using existing libraries.

Writing your own crypto software isn't a problem, and it can be very
educational.

Just don't _use_ your own crypto software.

Howerver, the set of people who write software without intending to use it is
pretty small...

--
Grant Edwards   grant.b.edwardsYow! ... the MYSTERIANS are
  at   in here with my CORDUROY
  gmail.comSOAP DISH!!

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


Re: Hi I'm trying to get live data from stock using python , is it

2018-09-05 Thread Michael Torrie
On 09/04/2018 10:21 AM, alon.naj...@gmail.com wrote:
> Hi ,
> for example:
> I want to know if AAPL is more than value 300 and if it does I want it to
send to me mail with gmail :) . thanks for the help..
>

Yes it's definitely possible!  Hop on Google and do some searches; you're bound
 to find some articles on the subject, possibly some demo code, and probably
some Python libraries to automate the process. Google search terms you'll want
to try include things like "python stock price email."

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


Re: Hi I'm trying to get live data from stock using python ,

2018-09-05 Thread Skip Montanaro
> I want to know if AAPL is more than value 300 and if it does I want it to
send to me mail with gmail :) . thanks for the help..

Try searching pypi.org for "finance", then scroll through the many returned
packages. A few show how to get stock data from Yahoo! or Google.

Skip

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


Re: Why list.reverse() modifies the list, but name.replace() does not

2018-09-05 Thread Mark Lawrence
On 03/09/18 18:49, C W wrote:
> Hello all,
>
> I am learning the basics of Python. How do I know when a method modifies
> the original object, when it does not. I have to exmaples:
> Example 1:
>> L = [3, 6, 1,4]
>> L.reverse()
>> L
> [4, 1, 6, 3]
> This changes the original list.

Lists are mutable, i.e. can be changed, so it makes sense to do this change in
place.

>
> Example 2:
>> name = "John Smith"
>> name.replace("J", j")
>> name
> 'John Smith'
> This does not change the original string.

Strings are immutable, i.e. cannot be changed, so you have to create a new
string.  Your call to `replace` will do just that, but as it's not saved `name`
 remains the same.  You could use

name = name.replace("J", j") or

newname = name.replace("J", j") as you see fit.

>
> Why the two examples produce different results? As a beginner, I find this
> confusing. How do you do it?
>
> Thank you!
>


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

Mark Lawrence

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


Re: Pass a list of values as options to 3 dropdown menus

2018-09-05 Thread Peter Pearson
On Sun, 2 Sep 2018 13:40:18 -0700 (PDT), Nick Berg wrote:
> how can i be able to store a list of values to drop-down menu and then
> grab the value that the user selects?
>
> **
> name = month = year = ''
>
> # populate names, months, years
> names.add( '' )
> months = ( '==', 'îÖî±î½î¿ïàî¬ïüî1î¿ ...
> years  = ( '=', 2010, 2011, 2012, 2 ...
>
>
> pdata = pdata + '''
> îòï î1î»îµîºïäî1îºîR
îæî½î±î¶îRïäî·ïâî·: 
>
> 
>  %s 
> 
>
> 
>  %s 
> 
>
> 
>  %s 
> 
> 
> 
> ''' % ( url_for( 'seek', name=name, month=month, year=year ), name, name,
month, month, year, year )
> **

I can't tell whether this is an HTML question or a Python question. If you can
reduce it to a Python question, perhaps I can help.

--
To email me, substitute nowhere->runbox, invalid->com.

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


Re: Hi I'm trying to get live data from stock using python , is it

2018-09-05 Thread Thomas Jollans
On 2018-09-04 18:22, alon.naj...@gmail.com wrote:
> On Tuesday, September 4, 2018 at 7:21:31 PM UTC+3, alon@gmail.com wrote:
>> Hi ,
>> for example:
>> I want to know if AAPL is more than value 300 and if it does I want it to
send to me mail with gmail :) . thanks for the help..

Of course it's possible. The standard library includes facilities modules for
interacting with web services, modules for writing emails, and everything else
you'll need.

>
> im using python 2.7
>

Please use Python 3, especially if you're new to Python. Python 2.7 is woefully
 out of date.

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


Re: Anaconda with Python 3.7

2018-09-05 Thread Alex Kaye
When one downloads Anaconda, doesn't it bring Pyhon with it ?

AK

On Mon, Sep 3, 2018 at 6:13 AM Thomas Jollans  wrote:

> On 2018-09-03 11:38, gvim wrote:
> > Anyone have any idea when Anaconda might ship a version compatible with
> > Python 3.7. I sent them 2 emails but no reply.
> >
> > gvim
>
> You can install Python 3.7 in a conda environment right now. Most
> packages (certainly all the ones I use) appear to be available for
> Python 3.7 at least on Windows and Linux already.
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

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


Re: Hi I'm trying to get live data from stock using python , is it poss

2018-09-05 Thread alon najman
On Tuesday, September 4, 2018 at 7:21:31 PM UTC+3, alon@gmail.com wrote:
> Hi ,
> for example:
> I want to know if AAPL is more than value 300 and if it does I want it to
send to me mail with gmail :) . thanks for the help..

im using python 2.7

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


Any SML coders able to translate this to Python?

2018-09-05 Thread Steven D'Aprano
I have this snippet of SML code which I'm trying to translate to Python:

fun isqrt n = if n=0 then 0
 else let val r = isqrt (n/4)
  in
if n < (2*r+1)^2 then 2*r
else 2*r+1
  end


I've tried reading up on SML and can't make heads or tails of the
"let...in...end" construct.


The best I've come up with is this:

def isqrt(n):
if n == 0:
return 0
else:
r = isqrt(n/4)
if n < (2*r+1)**2:
return 2*r
else:
return 2*r+1

but I don't understand the let ... in part so I'm not sure if I'm doing it
right.


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

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


Hi I'm trying to get live data from stock using python , is it possible

2018-09-05 Thread alon najman
Hi ,
for example:
I want to know if AAPL is more than value 300 and if it does I want it to send
to me mail with gmail :) . thanks for the help..

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


Re: Any SML coders able to translate this to Python?

2018-09-05 Thread Marko Rauhamaa
Steven D'Aprano :

> I have this snippet of SML code which I'm trying to translate to Python:
>
> fun isqrt n = if n=0 then 0
>  else let val r = isqrt (n/4)
>   in
> if n < (2*r+1)^2 then 2*r
> else 2*r+1
>   end
>
>
> I've tried reading up on SML and can't make heads or tails of the
> "let...in...end" construct.
>
>
> The best I've come up with is this:
>
> def isqrt(n):
> if n == 0:
> return 0
> else:
> r = isqrt(n/4)
> if n < (2*r+1)**2:
> return 2*r
> else:
> return 2*r+1
>
> but I don't understand the let ... in part so I'm not sure if I'm doing
> it right.

You must make sure "r" doesn't leak outside its syntactic context so:

def isqrt(n):
if n == 0:
return 0
else:
def f2398478957():
r = isqrt(n//4)
if n < (2*r+1)**2:
return 2*r
else:
return 2*r+1
return f2398478957()

(Also use // instead of /: isqrt = integer square root.)


Marko

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


problem with json.dumps / complexjson.loads in python 3.4 virtualenv

2018-09-05 Thread M. Fioretti
Greetings,

I have an error in a python application that I installed. I already opened an
issue about it on the application page at github, but I would also greatly
appreciate any help to (at least) better debug the problem, because I urgently
need to use that program.

Details:

I need to run the python client for the shaarli bookmarks manager, whose home
page is https://github.com/shaarli/python-shaarli-client, on a Centos release
7.5 x86_64 server. Since that client requires python >= 3.4, and I do not want
to move the whole server to that version, I created a virtualenv following the
instructions at
https://github.com/shaarli/python-shaarli-client/blob/master/docs/user/installa
tion.rst

When I try to run it, I get the error messages that I already reported in full
at

https://github.com/shaarli/python-shaarli-client/issues/33

as far as I can understand after some searching, it **may** be the problem
described at
https://mcgrattan.org/2017/01/24/ordered-json-in-python-with-requests/

but I honestly don't know enough python, to go further without some
help/pointers.

TIA,
Marco


--
http://mfioretti.com

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


Re: Any SML coders able to translate this to Python?

2018-09-05 Thread Paul Moore
On Tue, 4 Sep 2018 at 13:31, Steven D'Aprano
 wrote:
>
> I have this snippet of SML code which I'm trying to translate to Python:
>
> fun isqrt n = if n=0 then 0
>  else let val r = isqrt (n/4)
>   in
> if n < (2*r+1)^2 then 2*r
> else 2*r+1
>   end
>
>
> I've tried reading up on SML and can't make heads or tails of the
> "let...in...end" construct.
>
>
> The best I've come up with is this:
>
> def isqrt(n):
> if n == 0:
> return 0
> else:
> r = isqrt(n/4)
> if n < (2*r+1)**2:
> return 2*r
> else:
> return 2*r+1
>
> but I don't understand the let ... in part so I'm not sure if I'm doing
> it right.

I've not used SML much, but what you have looks right. let ... in is basically
a local binding "let x = 12 in x+2" is saying "the value of x+2 with x set to
12".

As I'm sure you realise (but I'll add it here for the sake of any newcomers who
 read this), the recursive approach is not natural (or efficient) in Python,
whereas it's the natural approach in functional languages like SML. In Python
an iterative solution would be better.

Paul

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


Re: Anaconda with Python 3.7

2018-09-05 Thread gvim
On 03/09/2018 10:49, Thomas Jollans wrote:
> On 2018-09-03 11:38, gvim wrote:
>> Anyone have any idea when Anaconda might ship a version compatible with
>> Python 3.7. I sent them 2 emails but no reply.
>>
>> gvim
>
> You can install Python 3.7 in a conda environment right now. Most
> packages (certainly all the ones I use) appear to be available for
> Python 3.7 at least on Windows and Linux already.
>

That's not the same as a specific Python 3.7 distribution. Why are they so
tight-lipped about it? I mean it's been a couple of months now. Do they usually
 take so long?

gvim

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


Re: Cross platform mutex to prevent script running more than instance?

2018-09-05 Thread Thomas Jollans
On 09/04/2018 05:35 AM, Cameron Simpson wrote:
> On 03Sep2018 07:45, Malcolm Greene  wrote:
>> Use case: Want to prevent 2+ instances of a script from running ...
>> ideally in a cross platform manner. I've been researching this topic and
>> am surprised how complicated this capability appears to be and how the
>> diverse the solution set is. I've seen solutions ranging from using
>> directories, named temporary files,â  named sockets/pipes, etc. Is there
>> any consensus on best practice here?
>
> I like os.mkdir of a known directory name. This tends to be atomic and
> forbidden when the name already exists, on all UNIX platforms, over
> remote filesystems. And, I expect, likewise on Windows.

The trouble with a simple lock file (or directory) is of course that it can't
recover from the program being killed or from program or system crashes without
 manual intervention. For some use cases that's fine, for others it's a
problem.

>
> All the other modes like opening files O_EXCL etc tend to be platform
> specific and not reliable over network filesystems.
>
> And pid based approaches don't work cross machine, if that is an issue.

I think a PID file is the traditional approach for *nix daemons, but as you
say, it does have its own drawbacks.

-- Thomas

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


Re: Cross platform mutex to prevent script running more than instance?

2018-09-05 Thread CFK
What about using flock()? I don't know if it works on Windows, but it works
really well for Unix/Linux systems.  I typically create a log file in a known
location using any atomic method that doesn't replace/overwrite a file, and
flock() it for the duration of the script.

Thanks,
Cem Karan

On Mon, Sep 3, 2018, 11:39 PM Cameron Simpson  wrote:

> On 03Sep2018 07:45, Malcolm Greene  wrote:
> >Use case: Want to prevent 2+ instances of a script from running ...
> >ideally in a cross platform manner. I've been researching this topic and
> >am surprised how complicated this capability appears to be and how the
> >diverse the solution set is. I've seen solutions ranging from using
> >directories, named temporary files,  named sockets/pipes, etc. Is there
> >any consensus on best practice here?
>
> I like os.mkdir of a known directory name. This tends to be atomic and
> forbidden when the name already exists, on all UNIX platforms, over remote
> filesystems. And, I expect, likewise on Windows.
>
> All the other modes like opening files O_EXCL etc tend to be platform
> specific
> and not reliable over network filesystems.
>
> And pid based approaches don't work cross machine, if that is an issue.
>
> Cheers,
> Cameron Simpson 
> --
> https://mail.python.org/mailman/listinfo/python-list
>

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


Re: Why list.reverse() modifies the list, but name.replace() does not

2018-09-05 Thread Mike C
Yes, I forgot that strings are immutable. I can't change anything in the
string. Silly me!

Thank you very much, I appreciate it. I guess sometimes it just take an
outsider to take you outside the box. And all is answered. :)


From: Python-list  on behalf
of Mark Lawrence  Sent: Monday, September 3, 2018
2:21:36 PM To: python-list@python.org
Subject: Re: Why list.reverse() modifies the list, but name.replace() does not
modify the string?

On 03/09/18 18:49, C W wrote:
> Hello all,
>
> I am learning the basics of Python. How do I know when a method modifies
> the original object, when it does not. I have to exmaples:
> Example 1:
>> L = [3, 6, 1,4]
>> L.reverse()
>> L
> [4, 1, 6, 3]
> This changes the original list.

Lists are mutable, i.e. can be changed, so it makes sense to do this change in
place.

>
> Example 2:
>> name = "John Smith"
>> name.replace("J", j")
>> name
> 'John Smith'
> This does not change the original string.

Strings are immutable, i.e. cannot be changed, so you have to create a new
string.  Your call to `replace` will do just that, but as it's not saved `name`
 remains the same.  You could use

name = name.replace("J", j") or

newname = name.replace("J", j") as you see fit.

>
> Why the two examples produce different results? As a beginner, I find this
> confusing. How do you do it?
>
> Thank you!
>


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

Mark Lawrence

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

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


Re: Anaconda with Python 3.7

2018-09-05 Thread Alex Kaye
Sorry bad typing.  AK


On Mon, Sep 3, 2018 at 7:07 AM Alex Kaye  wrote:

> When one downloads Anaconda, doesn't it
> bring Pyhon with it ?
>
> AK
>
> On Mon, Sep 3, 2018 at 6:13 AM Thomas Jollans  wrote:
>
>> On 2018-09-03 11:38, gvim wrote:
>> > Anyone have any idea when Anaconda might ship a version compatible with
>> > Python 3.7. I sent them 2 emails but no reply.
>> >
>> > gvim
>>
>> You can install Python 3.7 in a conda environment right now. Most
>> packages (certainly all the ones I use) appear to be available for
>> Python 3.7 at least on Windows and Linux already.
>>
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>

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


PyDev 6.5.0 released

2018-09-05 Thread Fabio Zadrozny
 PyDev 6.5.0 Release Highlights

   -

   *Debugger*
   - Debugger is *much* more responsive (fixed bug in reader/writer on the
  PyDev side).
  - *breakpoint()* builtin is now supported to add a programmatic
  breakpoint (on any Python version).
  - Watch expression no longer giving error if evaluation is empty
  (patch by glhez).
   -

   *Editor*
   - Code folding of *#region/#endregion* regions (patch by ghbcode).
  - There's a new action which allows creating local imports from a
  global import (use *Ctrl+1* on top of global import name).
   -

   It's now possible to change the default interpreter through an action
   (default binding: *Ctrl+Shift+Alt+I*).
   - The interactive console now has scroll lock (patch by bongibong).

About PyDev

PyDev is an open-source Python IDE on top of Eclipse for Python, Jython and
IronPython development, now also available for Python on Visual Studio Code.

It comes with goodies such as code completion, syntax highlighting, syntax
analysis, code analysis, refactor, debug, interactive console, etc.

It is also available as a standalone through LiClipse with goodies such as
multiple cursors, theming and support for many other languages, such as Django
Templates, Jinja2, Html, JavaScript, etc.

Links:

PyDev: http://pydev.org
PyDev Blog: http://pydev.blogspot.com PyDev on VSCode: http://pydev.org/vscode
LiClipse: http://www.liclipse.com
PyVmMonitor - Python Profiler: http://www.pyvmmonitor.com/

Cheers,

Fabio Zadrozny

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


Re: Why list.reverse() modifies the list, but name.replace() does not

2018-09-05 Thread Chris Angelico
On Tue, Sep 4, 2018 at 3:49 AM, C W  wrote:
> Hello all,
>
> I am learning the basics of Python. How do I know when a method modifies
> the original object, when it does not. I have to exmaples:
> Example 1:
>> L = [3, 6, 1,4]
>> L.reverse()
>> L
> [4, 1, 6, 3]
> This changes the original list.
>
> Example 2:
>> name = "John Smith"
>> name.replace("J", j")
>> name
> 'John Smith'
> This does not change the original string.
>
> Why the two examples produce different results? As a beginner, I find this
> confusing. How do you do it?

A very fair question.

Firstly, strings are immutable. Once you have a string, nothing can ever change
 it. Lists, on the other hand, can change (you can append to them, remove
elements, etc, etc). So reversing a string in-place is impossible, but it's an
option for the list.

Secondly, you get a clue from the return values.

>>> L = [3, 6, 1,4]
>>> L.reverse()
>>> L
[4, 1, 6, 3]
>>> name = "John Smith"
>>> name.replace("J", "j")
'john Smith'
>>> name
'John Smith'

Notice how name.replace() returns the new string, but L.reverse() doesn't
return anything? (Technically it returns None, but that's used as a signal
meaning "I got nuffin, govna!".) That's a strong clue; if something sounds like
 it ought to make a change, but it returns None, it's almost certainly changed
the object in-place.

If you like, you can iterate backwards over the list, rather than actually
reversing it:

for number in reversed(L): ...

And you can use a very convenient, if a little obscure, syntax to create a
reversed copy of the list:

>>> L
[4, 1, 6, 3]
>>> L[::-1]
[3, 6, 1, 4]

(So you can assign that to another name, or whatever.) This is called "slicing"
 the list, if you want to look it up in the docs.

Ultimately, your question comes down to the difference between mutable and
immutable types. Definitely something worth learning more about, and definitely
 worth asking these sorts of questions about.

Thanks for asking! :)

ChrisA

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


Re: Error installing libraries

2018-09-05 Thread Thomas Jollans
On 2018-09-03 09:10, ojas gupta wrote:
> error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft
Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-to
 ols
>
> 
> Command ""c:\users\ojas gupta\appdata\local\programs\python\python37\python.e
xe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\OJASGU~1\\AppData\\
 Local\\Temp\\pip-install-1d03ayeg\\mysqlclient\\setup.py';f=getattr(tokenize,
'open', open)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
C:\Users\OJASGU~1\AppData\Local\Temp\pip-record-wauonuy1\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in
C:\Users\OJASGU~1\AppData\Local\Temp\pip-install-1d03ayeg\mysqlclient\
>
>
> And the link provided to install Visual C++ 14.0 doesnâ Öt  work . I
installed Visual Studio 2017 and C++ Redistributable 2017 but same issue still
.


mysqlclient binary packages for Windows are available from Christoph Gohlke:
https://www.lfd.uci.edu/~gohlke/pythonlibs/ If you use these you won't need a C
 compiler.


As for the C compiler issue, I'd expect installing Visual Studio 2017 to work,
but I've only ever used the standalone "build tools" with Python on Windows
myself...
See:
https://wiki.python.org/moin/WindowsCompilers#Compilers_Installation_and_config
uration

>
> It will be extremely appreciated if u help me . Thanks .
>

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


Re: Why list.reverse() modifies the list, but name.replace() does not

2018-09-05 Thread Joel Goldstick
On Mon, Sep 3, 2018 at 1:50 PM C W  wrote:
>
> Hello all,
>
> I am learning the basics of Python. How do I know when a method modifies
> the original object, when it does not. I have to exmaples:
> Example 1:
> > L = [3, 6, 1,4]
> > L.reverse()
> > L
> [4, 1, 6, 3]
> This changes the original list.
>
> Example 2:
> > name = "John Smith"
> > name.replace("J", j")
> > name
> 'John Smith'
> This does not change the original string.
>
> Why the two examples produce different results? As a beginner, I find this
> confusing. How do you do it?
>
> Thank you!
> --
> https://mail.python.org/mailman/listinfo/python-list

Learn about help.  Go to python command line and type help(L) it will show that
 this method reverses in place.  Type help(name) and it will show that this
method returns the result, but does not change your list.

--
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays

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


Why list.reverse() modifies the list, but name.replace() does not

2018-09-05 Thread C W
Hello all,

I am learning the basics of Python. How do I know when a method modifies the
original object, when it does not. I have to exmaples: Example 1:
> L = [3, 6, 1,4]
> L.reverse()
> L
[4, 1, 6, 3]
This changes the original list.

Example 2:
> name = "John Smith"
> name.replace("J", j")
> name
'John Smith'
This does not change the original string.

Why the two examples produce different results? As a beginner, I find this
confusing. How do you do it?

Thank you!

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


Anaconda with Python 3.7

2018-09-05 Thread gvim
Anyone have any idea when Anaconda might ship a version compatible with Python
3.7. I sent them 2 emails but no reply.

gvim

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


Cross platform mutex to prevent script running more than instance?

2018-09-05 Thread Malcolm Greene
Use case: Want to prevent 2+ instances of a script from running ... ideally in
a cross platform manner. I've been researching this topic and am surprised how
complicated this capability appears to be and how the diverse the solution set
is. I've seen solutions ranging from using directories, named temporary files, 
 named sockets/pipes, etc. Is there any consensus on best practice here? Thank
you,
Malcolm

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


Re: Cross platform mutex to prevent script running more than instance?

2018-09-05 Thread D'Arcy Cain
On 09/03/18 09:45, Malcolm Greene wrote:
> Use case: Want to prevent 2+ instances of a script from running ...
> ideally in a cross platform manner. I've been researching this topic and
> am surprised how complicated this capability appears to be and how the
> diverse the solution set is. I've seen solutions ranging from using
> directories, named temporary files,  named sockets/pipes, etc. Is there
> any consensus on best practice here?

Here's my simple method which works in pure Python so I guess that makes it
cross-platform.  Well, as long as it has process IDs anyway.  There's a small
window between reading the file and writing the new one but for most purposes
that should be OK.  If you have to worry about those nano-second situations you
 will need to use one of those more complicated methods.

import os, sys

def ok2run(lockfile):
mypid = os.getpid()

try: pid = int(open(lockfile).read())
except FileNotFoundError: pass
else:
try: os.kill(pid, 0)
except OSError: pass
else: return False

print(mypid, file=open(lockfile, 'w'))
return True

if not ok2run("/tmp/lockfile"): sys.exit(0)

--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com

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


Re: Anaconda with Python 3.7

2018-09-05 Thread Thomas Jollans
On 2018-09-03 16:07, Alex Kaye wrote:
> When one downloads Anaconda, doesn't it
> bring Pyhon with it ?

It does, but one of the main features is the ability to create additional
virtual environments which can use different versions of Python. You can even
upgrade these environments to a different Python version, and all the
conda-installed (Python) packages will be installed in the new Python version.

https://conda.io/docs/user-guide/tasks/manage-environments.html

-- Thomas

PS: Please always make sure you reply on-list.

>
> AK
>
> On Mon, Sep 3, 2018 at 6:13 AM Thomas Jollans  > wrote:
>
> On 2018-09-03 11:38, gvim wrote:
> > Anyone have any idea when Anaconda might ship a version compatible
> with
> > Python 3.7. I sent them 2 emails but no reply.
> >
> > gvim
>
> You can install Python 3.7 in a conda environment right now. Most
> packages (certainly all the ones I use) appear to be available for
> Python 3.7 at least on Windows and Linux already.
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

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


Error installing libraries

2018-09-05 Thread ojas gupta
I am having trouble with installation of one library â £mysqlclientâ Ø and it
keeps on showing the same message  (copied below as it is
 ) .

THE MESSAGE :

C:\>pip install mysqlclient
Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d
1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient ... error
Complete output from command "c:\users\ojas
gupta\appdata\local\programs\python\python37\python.exe" -u -c "import
setuptools, tokenize;__file__='C:\\Users\\OJASGU~1\\AppData\\Local\\Temp\\pip-i
 nstall-1d03ayeg\\mysqlclient\\setup.py';f=getattr(tokenize, 'open',
open)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
C:\Users\OJASGU~1\AppData\Local\Temp\pip-record-wauonuy1\install-record.txt
--single-version-externally-managed --compile:
c:\users\ojas gupta\appdata\local\programs\python\python37\lib\distutils\di
st.py:274: UserWarning: Unknown distribution option:
'long_description_content_type'
  warnings.warn(msg)
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying _mysql_exceptions.py -> build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.7\MySQLdb
creating build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py ->
build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py ->
build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.7\MySQLdb\constant
s
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.7\MySQLdb\constant
s
copying MySQLdb\constants\FIELD_TYPE.py ->
build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py ->
build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py ->
build\lib.win-amd64-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools


Command ""c:\users\ojas gupta\appdata\local\programs\python\python37\python.exe
 " -u -c "import setuptools,
tokenize;__file__='C:\\Users\\OJASGU~1\\AppData\\Lo
cal\\Temp\\pip-install-1d03ayeg\\mysqlclient\\setup.py';f=getattr(tokenize,
'open', open)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
C:\Users\OJASGU~1\AppData\Local\Temp\pip-record-wauonuy1\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in
C:\Users\OJASGU~1\AppData\Local\Temp\pip-install-1d03ayeg\mysqlclient\


And the link provided to install Visual C++ 14.0 doesnâ Öt  work . I installed
Visual Studio 2017 and C++ Redistributable 2017 but same issue still .

It will be extremely appreciated if u help me . Thanks .

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


Re: Anaconda with Python 3.7

2018-09-05 Thread Thomas Jollans
On 2018-09-03 11:38, gvim wrote:
> Anyone have any idea when Anaconda might ship a version compatible with
> Python 3.7. I sent them 2 emails but no reply.
>
> gvim

You can install Python 3.7 in a conda environment right now. Most packages
(certainly all the ones I use) appear to be available for Python 3.7 at least
on Windows and Linux already.

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


Can't drop files on python scripts in a fresh installation of Windows

2018-09-05 Thread Random832
Python itself runs fine, but when I try to drop a file on a script it just
doesn't work.

If I try to regsvr32 the shell extension, it says: The module
"c:\windows\pyshellext.amd64.dll" failed to load.

There was no indication of any problem until this. Apparently it is linked
against "VCRUNTIME140.dll", not (or in addition to? peview shows both) the
universal CRT.

Installing the Visual C++ 2015 redistributable resolved it, but there was no
instruction for this.

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


[issue34588] traceback module can drop a frame

2018-09-05 Thread Benjamin Peterson


New submission from Benjamin Peterson :

Consider the following script:
import traceback

def fill_stack(depth):
if depth <= 1:
return traceback.format_stack()
else:
return fill_stack(depth - 1)

assert fill_stack(4) != fill_stack(5)

On the Python 3 versions I tested, this script doesn't fail! Somehow traceback 
is producing identical tracebacks for different callstacks.

--
components: Library (Lib)
messages: 324648
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: traceback module can drop a frame
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue34549] unittest docs could use another header

2018-09-05 Thread Nick


Change by Nick :


--
resolution:  -> works for me
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



[issue34568] Types in `typing` not anymore instances of `type` or subclasses of "real" types

2018-09-05 Thread Pekka Klärck

Pekka Klärck  added the comment:

My concerns with the behavior of `__origin__` possibly changing in the future 
seem to valid. In Python 3.5 and 3.6 the behavior is 

List.__origin__ is None
List[int].__origin__ is List

while in Python 3.7

List.__origin is list
List[int].__origin__ is list

Is it likely that this is going to change again or can I rely on the current 
behavior with Python 3.7+?

--

___
Python tracker 

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



[issue34481] Different behavior of C and Python impls of datetime.strftime with non-UTF-8-encodable strings

2018-09-05 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue34549] unittest docs could use another header

2018-09-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

You're welcome. Feel free to close this if it answers your question.

Thanks

--

___
Python tracker 

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



How to drop six support and go to Python 3 only?

2018-09-05 Thread Fabio Zadrozny
My scenario is having an app which was on Py 2, ported to Python 2 and 3
(using six) and will become Python 3 only in a few months.

So, my question is: when Python 2 is no longer needed, is there some tool
which helps removing the six compatibility layer (as well as the if
six.PY2/six.PY3 checks) so that the codebase becomes pythonic again?

Thanks,

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


[issue34586] collections.ChainMap should have a get_where method

2018-09-05 Thread Raymond Hettinger


Change 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



[issue8110] subprocess.py doesn't correctly detect Windows machines

2018-09-05 Thread Zachary Ware


Zachary Ware  added the comment:

This one has nothing to do with Cygwin, this is about minimizing patching that 
IronPython (or other implementations) have to do to standard library modules.

--

___
Python tracker 

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



[issue8110] subprocess.py doesn't correctly detect Windows machines

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

I don't think that we should backport this change to 3.7 and older.

I understand that the change is about supporting Cygwin. My policy to support a 
new platform is always the same: first fix *all* issues in master, get a 
working CI, find a core developer responsible to fix all issues specific to 
this platform, and only after that we can start discussing about backporting 
specific changes for that platform.

https://pythondev.readthedocs.io/cpython.html#i-want-cpython-to-support-my-platform

--

___
Python tracker 

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



[issue34584] subprocess

2018-09-05 Thread Joseph


New submission from Joseph :

Every time IDLE is opened this message "IDLE's subprocess didn't make 
connection.  Either IDLE can't start a subprocess or personal firewall software 
is blocking the connection" shows up.
When I open IDLE through .py programs the app crashes
crash code:
Process:   Python [5021]
Path:  /Applications/Python 3.7/IDLE.app/Contents/MacOS/Python
Identifier:org.python.IDLE
Version:   3.7.0 (3.7.0)
Code Type: X86-64 (Native)
Parent Process:??? [1]
Responsible:   Python [5021]
User ID:   501

Date/Time: 2018-09-05 17:09:24.893 +0800
OS Version:Mac OS X 10.13.4 (17E199)
Report Version:12
Anonymous UUID:01609E2F-27A5-CB5F-4612-5BA977830EA2

Sleep/Wake UUID:   30FAEA7D-EBF8-44D0-AE53-A40B0636777A

Time Awake Since Boot: 87000 seconds
Time Since Wake:   510 seconds

System Integrity Protection: enabled

Crashed Thread:0  Dispatch queue: com.apple.main-thread

Exception Type:EXC_CRASH (SIGABRT)
Exception Codes:   0x, 0x
Exception Note:EXC_CORPSE_NOTIFY

Termination Reason:Namespace OBJC, Code 0x1

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib  0x000101922ed6 __abort_with_payload 
+ 10
1   libsystem_kernel.dylib  0x00010191d2cf 
abort_with_payload_wrapper_internal + 89
2   libsystem_kernel.dylib  0x00010191d276 abort_with_reason + 
22
3   libobjc.A.dylib 0x000100e16962 
_objc_fatalv(unsigned long long, unsigned long long, char const*, 
__va_list_tag*) + 108
4   libobjc.A.dylib 0x000100e16814 _objc_fatal(char 
const*, ...) + 135
5   libobjc.A.dylib 0x000100e21f63 (anonymous 
namespace)::AutoreleasePoolPage::busted(bool) + 123
6   libobjc.A.dylib 0x000100e09da5 (anonymous 
namespace)::AutoreleasePoolPage::pop(void*) + 79
7   com.apple.CoreFoundation0x000100047a56 
_CFAutoreleasePoolPop + 22
8   com.apple.Foundation0x000103ee28ad -[NSAutoreleasePool 
drain] + 144
9   com.apple.Foundation0x000103f165a4 
_NSAppleEventManagerGenericHandler + 120
10  com.apple.AE0x00010a9ccdd0 
aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 
1788
11  com.apple.AE0x00010a9cc677 
dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 41
12  com.apple.AE0x00010a9cc565 aeProcessAppleEvent 
+ 383
13  com.apple.HIToolbox 0x0001078ad4a0 AEProcessAppleEvent 
+ 55
14  com.apple.AppKit0x0001045e1d32 _DPSNextEvent + 2788
15  com.apple.AppKit0x000104d77e34 
-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 
+ 3044
16  libtk8.6.dylib  0x000103d4594a 
-[TKApplication(TKNotify) nextEventMatchingMask:untilDate:inMode:dequeue:] + 44
17  com.apple.AppKit0x000104813e7b -[NSApplication 
_doModalLoop:peek:] + 476
18  com.apple.AppKit0x0001049f8c9f __35-[NSApplication 
runModalForWindow:]_block_invoke_2 + 64
19  com.apple.AppKit0x0001049f8c4c __35-[NSApplication 
runModalForWindow:]_block_invoke + 75
20  com.apple.AppKit0x000104ea7219 _NSTryRunModal + 100
21  com.apple.AppKit0x000104811911 -[NSApplication 
runModalForWindow:] + 133
22  com.apple.AppKit0x0001049e6eab __19-[NSAlert 
runModal]_block_invoke_2 + 158
23  com.apple.AppKit0x0001049e6dfa __19-[NSAlert 
runModal]_block_invoke + 75
24  com.apple.AppKit0x000104ea7219 _NSTryRunModal + 100
25  com.apple.AppKit0x000104886609 -[NSAlert runModal] 
+ 124
26  libtk8.6.dylib  0x000103d32f31 Tk_MessageBoxObjCmd 
+ 2098
27  libtcl8.6.dylib 0x000103b12f08 TclNRRunCallbacks + 
58
28  _tkinter.cpython-37m-darwin.so  0x000101beebf7 Tkapp_Call + 183
29  org.python.python   0x00010077aa7b 
cfunction_call_varargs + 299
30  org.python.python   0x000100856376 
_PyEval_EvalFrameDefault + 28614
31  org.python.python   0x00010084e740 
_PyEval_EvalCodeWithName + 3088
32  org.python.python   0x00010077a50a 
_PyFunction_FastCallKeywords + 218
33  org.python.python   0x00010084f04f call_function + 671
34  org.python.python   0x00010085243d 
_PyEval_EvalFrameDefault + 12429
35  org.python.python   0x00010084e740 
_PyEval_EvalCodeWithName + 3088
36  org.python.python   0x00010077a795 
_PyFunction_FastCallDict + 469
37  

[issue34587] test_socket: testCongestion() hangs on my Fedora 28

2018-09-05 Thread STINNER Victor


New submission from STINNER Victor :

Hi,

test_socket started to hang recently on my Fedora 28 laptop. No idea why it 
started to hang.

vstinner@apu$ ./python -m test -v test_socket -m testCongestion --timeout=5
== CPython 3.8.0a0 (heads/master-dirty:39487196c8, Sep 4 2018, 23:08:20) [GCC 
8.1.1 20180712 (Red Hat 8.1.1-5)]
== Linux-4.17.19-200.fc28.x86_64-x86_64-with-glibc2.26 little-endian
== cwd: /home/vstinner/prog/python/master/build/test_python_29510
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 1.34 [1/1] test_socket
testCongestion (test.test_socket.RDSTest) ... Timeout (0:00:05)!
Thread 0x7fccf51b1700 (most recent call first):
  File "/home/vstinner/prog/python/master/Lib/test/test_socket.py", line 2074 
in _testCongestion
  File "/home/vstinner/prog/python/master/Lib/test/test_socket.py", line 332 in 
clientRun

Thread 0x7fcd082ee080 (most recent call first):
  File "/home/vstinner/prog/python/master/Lib/threading.py", line 296 in wait
  File "/home/vstinner/prog/python/master/Lib/threading.py", line 552 in wait
  File "/home/vstinner/prog/python/master/Lib/test/test_socket.py", line 2059 
in testCongestion
  File "/home/vstinner/prog/python/master/Lib/unittest/case.py", line 610 in run
  File "/home/vstinner/prog/python/master/Lib/unittest/case.py", line 658 in 
__call__
  File "/home/vstinner/prog/python/master/Lib/unittest/suite.py", line 122 in 
run
  File "/home/vstinner/prog/python/master/Lib/unittest/suite.py", line 84 in 
__call__
  File "/home/vstinner/prog/python/master/Lib/unittest/suite.py", line 122 in 
run
  File "/home/vstinner/prog/python/master/Lib/unittest/suite.py", line 84 in 
__call__
  File "/home/vstinner/prog/python/master/Lib/unittest/runner.py", line 176 in 
run
  File "/home/vstinner/prog/python/master/Lib/test/support/__init__.py", line 
1900 in _run_suite
  File "/home/vstinner/prog/python/master/Lib/test/support/__init__.py", line 
1990 in run_unittest
  File "/home/vstinner/prog/python/master/Lib/test/test_socket.py", line 6032 
in test_main
  File "/home/vstinner/prog/python/master/Lib/test/libregrtest/runtest.py", 
line 179 in runtest_inner
  File "/home/vstinner/prog/python/master/Lib/test/libregrtest/runtest.py", 
line 140 in runtest
  File "/home/vstinner/prog/python/master/Lib/test/libregrtest/main.py", line 
384 in run_tests_sequential
  File "/home/vstinner/prog/python/master/Lib/test/libregrtest/main.py", line 
488 in run_tests
  File "/home/vstinner/prog/python/master/Lib/test/libregrtest/main.py", line 
566 in _main
  File "/home/vstinner/prog/python/master/Lib/test/libregrtest/main.py", line 
531 in main
  File "/home/vstinner/prog/python/master/Lib/test/libregrtest/main.py", line 
584 in main
  File "/home/vstinner/prog/python/master/Lib/test/__main__.py", line 2 in 

  File "/home/vstinner/prog/python/master/Lib/runpy.py", line 85 in _run_code
  File "/home/vstinner/prog/python/master/Lib/runpy.py", line 193 in 
_run_module_as_main

--
components: Tests
messages: 324643
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_socket: testCongestion() hangs on my Fedora 28
versions: Python 3.8

___
Python tracker 

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



[issue34568] Types in `typing` not anymore instances of `type` or subclasses of "real" types

2018-09-05 Thread Pekka Klärck

Pekka Klärck  added the comment:

While studying the types in the typing module more, I noticed they have a 
special `__origin__` attribute which seems to contain the "real" type they 
represent. I was able to make my type conversion code to work by adding these 
lines:

if hasattr(type_, '__origin__'):
type_ = type_.__origin__

All our tests pass with this simple fix, but I'm slightly worried using it 
because `__origin__` doesn't seem to be documented. This means I'm not sure is 
my usage OK and, more importantly, makes me worried that another change in 
typing changes the behavior or removes the attribute altogether. Hopefully 
someone with more insight on this can comment my worries. Perhaps the attribute 
should also be documented as discussed earlier: 
https://github.com/python/typing/issues/335

I'd also be a little bit happier with the above fix if I could write it like

if isinstance(type_, typing.SomeBaseType):
type_ = type_.__origin__

but apparently types in the typing module don't have any public base class. I 
guess odds that some unrelated class would have `__origin__` defined is small 
enough that using `hasattr(type_, '__origin__')` is safe.

--

___
Python tracker 

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



[issue8110] subprocess.py doesn't correctly detect Windows machines

2018-09-05 Thread Zachary Ware


Zachary Ware  added the comment:

The real question isn't "are we on Windows?" but rather "should we use 
msvcrt/_winapi or _posixsubprocess/select?", which is what my PR is designed to 
better fit.  I could see how we wouldn't want to backport that patch to 
maintenance branches, though; it's a significant rearrangement.  If we do want 
to backport *a* fix, I agree that simply adding `or os.name == 'nt'` should be 
sufficiently low-impact.

--

___
Python tracker 

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



[issue34530] distutils: find_executable() fails if the PATH environment variable is not set

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

I chose to merge the simplest change:

-path = os.environ['PATH']
+path = os.environ.get('PATH', os.defpath)

And I added unit tests for find_executable(). The bug is now fixed.

I'm not longer interested to reuse shutil.which() in 
distutils.find_executable(), since find_executable() first checks if the 
executable is in the current directory.

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks everybody! The issue should now be fixed in all supported branches ;-)

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9734024ec65311e33936faa83fb1cb249ef0de9d by Victor Stinner (Miss 
Islington (bot)) in branch '2.7':
bpo-26544: Get rid of dependence from distutils in platform. (GH-8356) (GH-8952)
https://github.com/python/cpython/commit/9734024ec65311e33936faa83fb1cb249ef0de9d


--

___
Python tracker 

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



[issue26544] platform.libc_ver() returns incorrect version number

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1a3eb125dc07a28a5af62446778ed7cca95ed3da by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
[3.7] bpo-26544: Get rid of dependence from distutils in platform. (GH-8356) 
(GH-8970) (GH-9061)
https://github.com/python/cpython/commit/1a3eb125dc07a28a5af62446778ed7cca95ed3da


--

___
Python tracker 

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



[issue34530] distutils: find_executable() fails if the PATH environment variable is not set

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e2c1657dff86decf1e232b66e766d2e51381109c by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
bpo-34530: Fix distutils find_executable() (GH-9049) (GH-9057)
https://github.com/python/cpython/commit/e2c1657dff86decf1e232b66e766d2e51381109c


--

___
Python tracker 

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



[issue34530] distutils: find_executable() fails if the PATH environment variable is not set

2018-09-05 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8531

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread Zachary Ware


Zachary Ware  added the comment:


New changeset 635461fca5e90c6e091f1e5b46adafc0d28bf0e2 by Zachary Ware in 
branch '3.6':
[3.6] bpo-34575: Build with only VS2015 on AppVeyor (GH-9066)
https://github.com/python/cpython/commit/635461fca5e90c6e091f1e5b46adafc0d28bf0e2


--

___
Python tracker 

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



[issue34568] Types in `typing` not anymore instances of `type` or subclasses of "real" types

2018-09-05 Thread Pekka Klärck

Pekka Klärck  added the comment:

Thanks for the PEP-560 reference. It explains the reasoning for the underlying 
changes, performance, and also mentions backwards incompatibility problems, 
including `issubclass(List[int], List)` causing a TypeError. It doesn't mention 
that `issubclass(List, list)` also raises a TypeError, though, nor that 
`isinstance(List, type)` now returns False.

I understand changing the implementation for performance reason, but I don't 
understand why that would require changing the behavior of `isinstance` and 
`issubclass`. The PEP explicitly mentions that the new `types.resolved_base` 
isn't called by them without explaining why. I guess that could be for 
performance reasons, but even then types in the typing could themselves 
implement `__instancecheck__` and `__subclasscheck__` and retain the old 
behavior. Or is there some actual reason for changing the behavior?

--

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

Discussion on python-dev:
https://mail.python.org/pipermail/python-dev/2018-September/155075.html

--

___
Python tracker 

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



[issue34586] collections.ChainMap should have a get_where method

2018-09-05 Thread Zahari Dim


New submission from Zahari Dim :

When using ChainMap I have frequently needed to know the mapping inside the list
that contains the effective instance of a particular key. I have needed this
when using ChainMap to contain a piece of configuration with multiple sources,
like for example

```
from mycollections import ChainMap
configsources = ["Command line", "Config file", "Defaults"]
config = ChainMap(config_from_commandline(), config_from_file(),
  default_config())

class BadConfigError(Exception): pass
def get_key(key):
try:
index, value = config.get_where(key)
except KeyError as e:
raise BadConfigError(f"No such key: '{key}'") from e
try:
result = validate(key, value)
except ValidationError as e:
raise BadConfigError(f"Key '{key}' defined in {configsources[index] }"
 f"is invalid: {e}") from e
return result
```

I have also needed this when implementing custom DSLs (e.g. specifying which
context is a particular construct allowed to see).

I think this method would be generally useful for the ChainMap class and
moreover the best way of implementing it I can think of is  by copying the
`__getitem__` method and retaining the index:

```
class ChainMap(collections.ChainMap):
def get_where(self, key):
for i, mapping in enumerate(self.maps):
try:
return i, mapping[key] # can't use 'key in mapping' 
with defaultdict
except KeyError:
pass
return self.__missing__(key)# support subclasses that 
define __missing__
```

I'd be happy to write a patch that does just this.

--
components: Library (Lib)
messages: 324632
nosy: Zahari.Dim
priority: normal
severity: normal
status: open
title: collections.ChainMap should have a get_where method
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread Zachary Ware


Change by Zachary Ware :


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

___
Python tracker 

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



[issue34577] imaplib Cyrillic password

2018-09-05 Thread Nikita Velykanov


Nikita Velykanov  added the comment:

It works. Thanks a lot!

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



[issue34481] Different behavior of C and Python impls of datetime.strftime with non-UTF-8-encodable strings

2018-09-05 Thread Paul Ganssle


Paul Ganssle  added the comment:

I've left a mostly finished PR on #8983, but I've decided it's not really worth 
continuing to work on. Anyone can feel free to take it and run with it if they 
want to implement the fix for this.

As Alexey mentions, that PR indeed already fixes this bug, I mainly blocked on 
getting consistent behavior across all platforms. Currently that PR has 
consistent behavior across all platforms if you disable wcsftime *except* 
Ubuntu 14.0, which seems to have some kind of funky bug in wcstombs, though for 
the life of me I don't know how to consistently trigger it. I suspect that 
using strftime instead of wcsftime on all platforms would lead to simpler code 
that works most consistently, but I am guessing wcsftime is faster.

Another option is to use wsftime but fall back to strftime on MacOS in the 
event that the error condition (blank output from non-blank input) is detected.

--

___
Python tracker 

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



[issue34584] subprocess

2018-09-05 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I'm not to happy about the crash, the interpreter shouldn't crash like this. 
This may well be Tk related though.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> pending
type:  -> crash

___
Python tracker 

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



[issue7727] xmlrpc library returns string which contain null ( \x00 )

2018-09-05 Thread Fredrik Larsen


Change by Fredrik Larsen :


--
nosy: +fredrikhl

___
Python tracker 

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



[issue34584] subprocess

2018-09-05 Thread Joseph


Joseph  added the comment:

Problem saved... turns out I saved a math.py file in my python location and 
thats what cause the crash. when i remove the math.py file or change its name, 
python got back to work. thanks

--

___
Python tracker 

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



[issue34584] subprocess

2018-09-05 Thread Joseph


Change by Joseph :


--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



Re: CURSES WINDOWS

2018-09-05 Thread Abhiram R
And here I thought this was a rant :D

On Tue, Sep 4, 2018 at 8:33 PM shinobi  wrote:
> >
> > Hello All,
> >
> > can anyone please let me know what's the path to port linux python curses
> > program to Windows?
> >
> > Thanks
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
>
>
-- 
Abhiram R

abhiramr.github.io
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue34585] Don't use AC_RUN_IFELSE to determine float endian

2018-09-05 Thread Ross Burton


New submission from Ross Burton :

Currently configure.ac uses AC_RUN_IFELSE to determine the byte order of floats 
and doubles.  This hurts when cross-compiling because a default is set, 
resulting in Python silently falling back to sub-optimal codepaths.

A partial improvement would be to not set a fallback, to force the user to set 
the right byte order explicitly.

However this test can be done without running anything.  autoconf-archive has a 
macro that uses a carefully constructed double that encodes to an ASCII string 
in the binary, which is then examined using grep.  Evil genius.

Attached is a POC using this.  Currently the autoconf-archive macro only 
handles big and little endian not the ARM OABI mixed-endian format, so 
configure.ac assumes if the byte order is unknown then it's the crazy 
mixed-endian.

To be honest OABI is so old now, I don't believe anyone actually uses it 
anymore: everyone still on ARMv4 should have moved to EABI many years ago, and 
the mixed-endian support could be removed from Py3 in the future.

--
components: Build
files: 0001-Don-t-do-runtime-test-to-get-float-byte-order.patch
keywords: patch
messages: 324627
nosy: rossburton
priority: normal
severity: normal
status: open
title: Don't use AC_RUN_IFELSE to determine float endian
versions: Python 3.8
Added file: 
https://bugs.python.org/file47788/0001-Don-t-do-runtime-test-to-get-float-byte-order.patch

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread Paul Moore


Paul Moore  added the comment:

One thought - appveyor.yml says that the cache of externals depends on PCBuild. 
Could it be that appveyor is caching PCBuild to verify whether it's changed 
(and hence whether to use the cached externals)? I know that sounds bizarre, 
but I'm not entirely sure why externals should be dependent on the *whole* of 
PCBuild anyway - maybe we should change it to depend only on 
PCBuild/get_externals.bat?

Clutching at straws here, there's definitely nothing obvious I can see though.

--

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Ah ok, I thought disabling the cache with APPVEYOR_CACHE_SKIP_RESTORE as true 
will trigger a successful build and in the end it will store the new set of 
artifacts from the recent compiler to the cache and then we can toggle the 
environment variable (APPVEYOR_CACHE_SKIP_RESTORE) so that for the next build 
artifacts built from old compiler are replaced with the newer ones resembling a 
cache clear. Sorry I might be wrong here and it's a workaround that I thought 
will work as in the other CI systems. I will be happy if it's solved through 
API then with the right credentials.

Thanks

--

___
Python tracker 

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



[issue34584] subprocess

2018-09-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Might be related to the below : 

open issue : https://bugs.python.org/issue14576

https://bugs.python.org/issue14576
https://bugs.python.org/issue16758
https://bugs.python.org/issue10722
https://bugs.python.org/issue7217

I think from the above threads you have something in path that collides with 
the name of some file in Python standard library.

Ref : 
https://stackoverflow.com/questions/29567051/python-error-idles-subprocess-didnt-make-connection-either-idle-cant-start

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue34200] importlib: python -m test test_pkg -m test_7 fails randomly

2018-09-05 Thread Nick Coghlan


Nick Coghlan  added the comment:

My guess as to why we're only seeing this for parallel test cases is taht for 
sequential tests, the implicit import inside open() is unlikely to happen while 
test_pkg is running, whereas for parallel tests, test_pkg will run in a 
relatively pristine process, and hence be more likely to trigger the implicit 
import.

--

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

> APPVEYOR_CACHE_SKIP_RESTORE - set to true to disable cache restore
> APPVEYOR_CACHE_SKIP_SAVE - set to true to disable cache update

I see these as well, but it would only be a temporary solution and may make 
build much slower, whereas AppVeyor is already a bottleneck in our workflow. 
AppVeyor only give us two jobs in parallel which take 10-30 min, whereas it's 
common that we have much more new pull requests per hour.

--

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

One another way will be to set environment variable to skip the cache restore 
and trigger a build to see if cache is the actual problem. I don't know how 
configurable environment variables are from the UI to trigger a specific build 
with the set of environment variable values.

https://www.appveyor.com/docs/build-cache/#skipping-cache-operations-for-specific-build

> Skipping cache operations for specific build

> You can skip cache restore or save stages with the following tweak 
> environment variables:

> APPVEYOR_CACHE_SKIP_RESTORE - set to true to disable cache restore
> APPVEYOR_CACHE_SKIP_SAVE - set to true to disable cache update


Thanks

--

___
Python tracker 

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



[issue34566] pipe read sometimes returns EOF but returncode is still None

2018-09-05 Thread pmoravec


pmoravec  added the comment:

> The "poll" method does not wait for the child to exit. Normally you use the 
> "wait" method in this situation. I suspect this is a bug in the application, 
> not in Python.

Thanks for clarification. Could you please confirm what code change in that 
script is safe, then?

1) looping "while p.poll() == None   pass" to really ensure some status is 
returned.

2) calling p.wait() before p.poll()

>From a blackbox perspective, I would expect either to provide similar fixing 
>mechanism of my script. But as we call this code snippet concurrently, for 
>random commands that randomly terminates with random outcome / status, can't 
>either fix attempt cause e.g. a deadlock?

Thanks in advance for help / advice.

(just for context if it matters: the snippet is from 
https://github.com/sosreport/sos/blob/master/sos/utilities.py#L158 where the 
sos_get_command_output method is called concurrently by more threads)

--
nosy: +pmoravec

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Another way will be to invalidate the cache by manually updating 
cleanup-cache.txt in the end. But this requires a commit that has to be 
reverted later to enable caching and I don't think it's worthy to pollute git 
history for this.

https://help.appveyor.com/discussions/questions/1310-delete-cache#comment_36916917


> You can have any file as dependency that will be triggering cache 
> invalidation, even "cleanup-cache.txt" say in the root of your repo:
> cache:
> - my_cached_folder -> cleanup-cache.txt
> Whenever CRC32 of cleanup-cache.txt is changed the cache is invalidated, i.e. 
> not restored in the beginning of the build.

@paul.moore It's here : 
https://github.com/python/cpython/blob/master/.github/appveyor.yml


Thanks

--

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

Ah! If I user my personal account which has a different token, I'm able to list 
my roles using the REST API.

So it seems that I lack some permissions on the "python" account of AppVeyor. 
Who owns this account?

--

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread Paul Moore


Paul Moore  added the comment:

I don't see an appveyor.yml file in the CPython repository. How are
the appveyor builds configured? I was going to take a look, but need
to see the config :-(
On Wed, 5 Sep 2018 at 10:32, STINNER Victor  wrote:
>
>
> STINNER Victor  added the comment:
>
> REST API for the AppVeyor build cache:
> https://www.appveyor.com/docs/build-cache/#rest-api
>
> Authentication of the REST API:
> https://www.appveyor.com/docs/api/#authentication
>
> I tried:
>
> $ curl -H "Authorization: Bearer " -X "DELETE" 
> https://ci.appveyor.com/api/projects/python/cpython/buildcache; echo
>
> {"message":"You do not have required permissions to perform this action."}
>
> Oh. I'm not allowed to clear the build cache :-(
>
> I'm logged as "python" and my role is "Super User". If a Super User is not 
> allowed to clear the cache, who is allowed to do that? Maybe my URL is wrong? 
> The documentation says:
>
> DELETE 
> https://ci.appveyor.com/api/projects/{accountName}/{projectSlug}/buildcache
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread STINNER Victor


STINNER Victor  added the comment:

REST API for the AppVeyor build cache:
https://www.appveyor.com/docs/build-cache/#rest-api

Authentication of the REST API:
https://www.appveyor.com/docs/api/#authentication

I tried:

$ curl -H "Authorization: Bearer " -X "DELETE" 
https://ci.appveyor.com/api/projects/python/cpython/buildcache; echo

{"message":"You do not have required permissions to perform this action."}

Oh. I'm not allowed to clear the build cache :-(

I'm logged as "python" and my role is "Super User". If a Super User is not 
allowed to clear the cache, who is allowed to do that? Maybe my URL is wrong? 
The documentation says:

DELETE 
https://ci.appveyor.com/api/projects/{accountName}/{projectSlug}/buildcache

--

___
Python tracker 

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



[issue8110] subprocess.py doesn't correctly detect Windows machines

2018-09-05 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

If os.name == 'nt' is True on IronPython then why not simply do:

mswindows = sys.platform == "win32" or os.name == "nt"

For the record, both variants are used in different places in cPython source 
code. It would nice to figure out a golden standard and apply it everywhere. 
Maybe even add it as a new WINDOWS constant in the platform module.

--

___
Python tracker 

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



[issue34575] Python 3.6 compilation fails on AppVeyor: libeay.lib was created with an older compiler

2018-09-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

If it's due to cache then there is a REST API to clear the cache manually and 
someone with access to Appveyor credentials can give it a try to clear the 
cache and see if it's fixed.

Ref : https://github.com/appveyor/ci/issues/985

Log in and execute the below from the console as per 
https://github.com/appveyor/ci/issues/985#issuecomment-279199811

$.ajax({
url: 'https://ci.appveyor.com/api/projects///buildcache',
type: 'DELETE'})

A workaround : https://help.appveyor.com/discussions/questions/1310-delete-cache


Thanks

--
nosy: +xtreak

___
Python tracker 

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



  1   2   >