[issue30691] WeakSet is not pickleable

2017-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The method is broken (and always was). Pickling doesn't work because the state 
contains unpickleable object. Copying works incorrectly, since the pickle state 
contains references to the original WeakSet and it overrides the __dict__ of 
the copy, making its state inconsistent. If the purpose of implementing the 
__reduce__ method was the support of the copying, the __reduce__ method should 
be fixed or the copying should be implemented with implementing the __copy__ 
and __deepcopy__ methods.

However there is a subtle moment with pickling WeakSet (as well as with 
pickling weakref.proxy, see issue18068). The problem is that if you pickled a 
WeakSet, but not hard references to its items, the items will be disappeared 
just after unpickling, since they have no hard references. This may confuse. If 
you pickle also hard refereces to the items, a WeakSet can be pickled and 
unpickled as expected (after fixing __reduce__).

--

___
Python tracker 

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



[issue30664] Change unittest's _SubTest to not sort its params when printing test failures

2017-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +2316

___
Python tracker 

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



[issue30664] Change unittest's _SubTest to not sort its params when printing test failures

2017-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PR 2265 implements a private subclass of ChainMap that preserves ordering.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: Google Sheets API Error

2017-06-17 Thread Gregory Ewing

Matt Wheeler wrote:

My best guess is some of your code which you haven't shown us is calling
`os.chdir()` and then you're not moving back.

When I encounter this problem I usually mitigate it using a context manager


Or avoid using chdir at all, and use full pathnames to refer
to things in other directories.

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


[issue29702] Error 0x80070003: Failed to launch elevated child process

2017-06-17 Thread Armen Levonian

Armen Levonian added the comment:

OK, so this bug tuned out to be related to the Windows 10 version I had prior 
to the just now updated 1703.
I discovered one other Visual Studio installation that was failing.
However, after the update to the latest Windows 1703, the installation issues 
are resolved.

So we can close this as it seems it was a possibly broken windows 10 version. 
As a reminder, I was only experiencing this issue on only 1 machine.

Cheers.

--
resolution:  -> out of date

___
Python tracker 

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



[issue30671] dict: improve lookup function

2017-06-17 Thread Tim Peters

Tim Peters added the comment:

The attached hashsim.py pretty much convinces me there's nothing left to be 
gained here.  It shows that the current scheme essentially achieves the 
performance of theoretical "uniform hashing" for string keys, for both 
successful and unsuccessful searches, as measured by the average number of 
probes needed.  Uniform hashing is the head scheme in which, for each key, the 
probe sequence is chosen uniformly at random from the set of all table slot 
permutations.  Its advantage is that it's feasible to analyze - its 
disadvantage is that it can't actually be sanely implemented ;-)

Back when the current scheme was implemented, string keys sometimes behaved 
"better than random", for reasons explained in the code comments.  The string 
hash now is more like a high-quality PRNG, so the performance of uniform 
hashing is the best that can be hoped for.  Dicts with int keys can still enjoy 
better-than-random performance.

Back then I was using a 32-bit box, and I'm pleased to see that PERTURB_SHIFT=5 
still appears to work well on a 64-bit box (note:  to a first approximation you 
can emulate a 32-bit box on a 64-bit box by setting M64 in the code to a 32-bit 
mask).  But the choice appears far less touchy on a 64-bit box, and it may help 
a little to increase PERTURB_SHIFT.  Not so much in the average case, but for 
pathological cases, like int keys all of which have a lot of trailing zeroes.  
Before the bits that differ get shifted down far enough to matter, they all 
follow the same probe sequence.  Increasing PERTURB_SHIFT would reduce the 
number of iterations needed before that happens.  But I'd wait until someone 
complains before churning the code just for that ;-)

--
Added file: http://bugs.python.org/file46957/hashsim.py

___
Python tracker 

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



[issue30690] ChainMap doesn't preserve the order of ordered mappings

2017-06-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Until regular dicts guarantee order, I don't want to go down this path for 
ChainMap which currently makes no guarantees about preserving and passing 
through properties of the underlying mappings.   The current implementation is 
short, fast, and reliable.  I don't want to trade any of those for a feature 
that we don't even guarantee for regular dicts.

For http://bugs.python.org/issue30664, I recommend going with Eric's suggestion 
in http://bugs.python.org/issue30664#msg296005.

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



[issue30689] len() and iter() of ChainMap don't work with unhashable keys

2017-06-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

No thank you.  It is perfectly reasonable to use set operations to make the 
implementation simple, fast, reliable, and suitable for most use cases.  
Marking this as a rejected feature request.

As for documentation, I don't see any need to accommodate a pedantic reading of 
"mapping" in the general sense versus collections.Mapping in the formal sense.  
Additional text would likely create more confusion than it solves and would 
likely get in the way of normal users who are just trying to learn how to use 
ChainMap.

If you truly feel that users need to know about every place that the  adjective 
"mapping" carries with it a dependency on hashability, then consider a FAQ 
entry or blog post on the subject.  Otherwise, we going have to replace term 
"mapping" with the more awkward "dict-like object".

Serhiy, while I admire your devotion to studying all the code in the standard 
library, it really isn't helpful to have you challenge and second guess every 
single design decision.  While you may have a ton of spare time to generate 
enormous numbers of PRs, feature requests, and bug reports, it is eating-up 
*all* of my development time.  It is a constant distraction from real work than 
needs to be done.   In particular, most of the issues seem to be "invented 
problems" that aren't based on any actual user need or reported problem.  
Further, it risks excessive code churn, feature creep, risk of introducing new 
problems/incompatibilities, and destabilizes published code.  It may be fun to 
rewrite everything you look at, but it isn't a good practice.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue30672] PEP 538: Unexpected locale behaviour on *BSD (including Mac OS X)

2017-06-17 Thread Nick Coghlan

Changes by Nick Coghlan :


--
assignee:  -> ncoghlan

___
Python tracker 

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



[issue30647] CODESET error on AMD64 FreeBSD 10.x Shared 3.x caused by the PEP 538

2017-06-17 Thread Nick Coghlan

Changes by Nick Coghlan :


--
assignee:  -> ncoghlan

___
Python tracker 

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



Re: [RELEASE] Python 3.6.2rc1 is now available for testing

2017-06-17 Thread Terry Reedy

On 6/17/2017 10:31 PM, Ned Deily wrote:

You can find Python 3.6.2rc1 here:

https://www.python.org/downloads/release/python-362rc1/


Running Debug|Win32 interpreter...
== CPython 3.6.1+ (heads/3.6:0a794a3256, Jun 17 2017, 17:03:32)
has 1 error, winreg hangs, resists Keyboard interrupt, must click [X] to 
close.


Windows amd64 installer.
has 5 more errors.
test_codecencodings_iso2022  multiple failures
test_random  multiple failures
test_sax  multiple failures
test_regrtest  failed in test_pcbuild_rt, FileNotFoundError in subprocess
test_tools  2to3 it seems
test_winreg  looped forever, keyboard interrupt ignored for a minute, 
then locked console in threading waiting or lock or lock acquire.


I reran, redownloaded and reinstalled, same thing.

--
Terry Jan Reedy

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


[issue30691] WeakSet is not pickleable

2017-06-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> I wondering whether WeakSet should be made pickleable or 
> the __reduce__ method should be removed.

When considering whether to remove a method from long published code, if the 
method isn't broken, our guidance should come from whether user's have actually 
taken advantage of __reduce__.   Determining that answer involves searching 
published code (Google's code search used to be a good tool for this, now we've 
got Github's code search tools).  

In general, the burden is high for removing an existing feature (even if 
untested); otherwise, we risk breaking people's code for no good reason other 
than the joy that comes with churning code to solve an invented problem (one 
that has never arisen in real code and has never been reported by an actual 
user).

When considering whether to add pickle support, the bar is much lower.  Roughly 
the question is amounts to balancing the potential benefits (whether someone 
might need to pickle a weakset someday even though we have no evidence that 
anyone has ever wanted this) versus the costs (risk of introducing bugs, 
creating cross-version incompatabilities, increasing future maintenance costs, 
increasing the total code volume, etc).

If adding pickling capability is easy and clean, then it seems reasonable.   On 
the other hand, if it is even slightly tricky, we should skip adding a feature 
that no one has ever asked for.  The 
weak reference containers have long been a source of bugs, some of which were 
challenging to fix.

--

___
Python tracker 

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



[issue29933] asyncio: set_write_buffer_limits() doc doesn't specify unit of the parameters

2017-06-17 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue30686] make `make install` faster

2017-06-17 Thread INADA Naoki

Changes by INADA Naoki :


--
pull_requests: +2315

___
Python tracker 

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



[issue29591] Various security vulnerabilities in bundled expat (CVE-2016-0718 and CVE-2016-4472)

2017-06-17 Thread Ned Deily

Ned Deily added the comment:

FYI, expat 2.2.1 has now been released.  See Issue30694 for details.

--

___
Python tracker 

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



[issue30694] Update embedded copy of expat to 2.2.1

2017-06-17 Thread Ned Deily

New submission from Ned Deily:

>From the announcement:

Expat 2.2.1 has been released.  The change log has more details [2] than this 
mail, including commit SHA1s. For a quick overview of the security fixes and 
CVEs, we have:

   CVE-2017-9233  External entity infinite loop DoS [1]
  (CVE-2016-9063) Integer overflow (re-fix)
 n/a  More integer overflow fixes
  (CVE-2016-0718) Fix regression bugs from 2.2.0's fix to CVE-2016-0718
  (CVE-2016-5300) Use os-specific entropy sources like getrandom
 n/a  No longer leak parser pointer information
 n/a  Prevent use of uninitialised variables
 n/a  Add missing API parameter validation (NULL, len<0)
  (CVE-2012-0876) Counter hash flooding with SipHash

https://github.com/libexpat/libexpat/blob/R_2_2_1/expat/Changes

https://libexpat.github.io/doc/cve-2017-9233/

--
components: Library (Lib)
messages: 296254
nosy: haypo, ned.deily
priority: deferred blocker
severity: normal
stage: needs patch
status: open
title: Update embedded copy of expat to 2.2.1
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



[issue30693] tarfile add uses random order

2017-06-17 Thread Bernhard M. Wiedemann

Changes by Bernhard M. Wiedemann :


--
pull_requests: +2313

___
Python tracker 

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



[issue30565] PEP 538: silence locale coercion and compatibility warnings by default?

2017-06-17 Thread Nick Coghlan

Nick Coghlan added the comment:

OK, PEP 538 is effectively disabled on FreeBSD and Mac OS X now, and the locale 
coercion and compatibility warnings are off by default everywhere.

PYTHONCOERCECLOCALE=warn is explicitly documented as a debugging tool for use 
when folks already suspect that locale coercion or legacy locale 
incompatibility might be to blame for particular problems that they're seeing.

--
resolution:  -> fixed
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



[RELEASE] Python 3.6.2rc1 is now available for testing

2017-06-17 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release team, 
I would like to announce the availability of Python 3.6.2rc1. 3.6.2rc1 is the 
first release candidate for Python 3.6.2, the next maintenance release of 
Python 3.6. While 3.6.2rc1 is a preview release and, thus, not intended for 
production environments, we encourage you to explore it and provide feedback 
via the Python bug tracker (https://bugs.python.org).

Please see "What’s New In Python 3.6" for more information:

https://docs.python.org/3.6/whatsnew/3.6.html

You can find Python 3.6.2rc1 here:

https://www.python.org/downloads/release/python-362rc1/

and its change log here:

https://docs.python.org/3.6/whatsnew/changelog.html#python-3-6-2-release-candidate-1

3.6.2 is planned for final release on 2017-06-30 with the next maintenance 
release expected to follow in about 3 months. More information about the 3.6 
release schedule can be found here:

https://www.python.org/dev/peps/pep-0494/

--
  Ned Deily
  n...@python.org -- []

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


[issue30565] PEP 538: silence locale coercion and compatibility warnings by default?

2017-06-17 Thread Nick Coghlan

Nick Coghlan added the comment:


New changeset eb81795d7d3a8c898fa89a376d63fc3bbfb9a081 by Nick Coghlan in 
branch 'master':
bpo-30565: Add PYTHONCOERCECLOCALE=warn runtime flag (GH-2260)
https://github.com/python/cpython/commit/eb81795d7d3a8c898fa89a376d63fc3bbfb9a081


--

___
Python tracker 

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



[issue29933] asyncio: set_write_buffer_limits() doc doesn't specify unit of the parameters

2017-06-17 Thread Kojo Idrissa

Changes by Kojo Idrissa :


--
pull_requests: +2312

___
Python tracker 

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



[issue30693] tarfile add uses random order

2017-06-17 Thread Bernhard M. Wiedemann

New submission from Bernhard M. Wiedemann:

Filesystems do not give any guarantees about ordering of files returned in 
directory listings, thus tarfile.add adds files in random order, when using 
os.listdir in recursion.

See also https://reproducible-builds.org/docs/stable-inputs/ on that topic.

--
components: Library (Lib)
messages: 296251
nosy: bmwiedemann
priority: normal
severity: normal
status: open
title: tarfile add uses random order
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



[issue30672] PEP 538: Unexpected locale behaviour on *BSD (including Mac OS X)

2017-06-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Flagging issue 30647 as a dependency, since the problem with breaking 
nl_langinfo will need to be fixed before these tests can be re-enabled.

--
dependencies: +CODESET error on AMD64 FreeBSD 10.x Shared 3.x caused by the PEP 
538

___
Python tracker 

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



[issue30565] PEP 538: silence locale coercion and compatibility warnings by default?

2017-06-17 Thread Nick Coghlan

Nick Coghlan added the comment:

OK, based on the latest round of custom buildbot results (e.g. 
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%20custom/builds/12/steps/test/logs/stdio
 ), it looks like the main remaining problems are those covered by issue 30672, 
where *BSD platforms handle some locales differently from the way Linux handles 
them (and Mac OS X then inherits those differences), and issue 30647 (where 
attempting to use the UTF-8 locale can cause nl_langinfo to fail).

So for the latest iteration on *this* change, I'm going to do the following:

1. Disable "UTF-8" as a candidate target locale
2. Adjust the test suite's expectations accordingly

--

___
Python tracker 

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



[issue30672] PEP 538: Unexpected locale behaviour on *BSD (including Mac OS X)

2017-06-17 Thread Nick Coghlan

Nick Coghlan added the comment:

It seems the "POSIX is not just an alias for the C locale" behaviour is 
inherited from *BSD, rather than being specific to Mac OS X: 
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%20custom/builds/12/steps/test/logs/stdio

--
title: PEP 538: Unexpected locale behaviour on Mac OS X -> PEP 538: Unexpected 
locale behaviour on *BSD (including Mac OS X)

___
Python tracker 

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



[issue30576] http.server should support HTTP compression (gzip)

2017-06-17 Thread Martin Panter

Martin Panter added the comment:

I think neither Pierre’s nor Glenn’s implementations should be added to 
SimpleHTTPRequestHandler. In fact I think most forms of content negotiation are 
only appropriate for a higher-level server. It seems too far removed from the 
intention of the class, “directly mapping the directory structure to HTTP 
requests”.

Another concern with Pierre’s proposal is the delay and memory or disk usage 
that would be incurred for a large file (e.g. text/plain log file), especially 
with HEAD requests. I have Linux computers set up with /tmp just held in 
memory, no disk file system nor swap. It would be surprising that a HTTP 
request had to copy the entire file into memory before sending it.

It may be reasonable to serve the Content-Encoding field based on the stored 
file though. If the client requests file “xyz”, there should be no encoding, 
but if the request was explicitly for “xyz.gz”, the server could add 
Content-Encoding. But I suspect this won’t help Pierre.

Some other thoughts on the pull request:
* x-gzip is supposed to be an alias in HTTP 1.1 requests
* The response is HTTP 1.0, where x-gzip seems to be the canonical name
* In HTTP 1.1 requests, consider supporting Accept-Encoding: gzip;q=1
* Accept-Encoding: gzip;q=0
* Accept-Encoding: *
* Accept-Encoding: GZIP (case insensitivity)

--

___
Python tracker 

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



[issue30429] bdb and pdb: Add watchpoint function

2017-06-17 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



Re: Google Sheets API Error

2017-06-17 Thread Matt Wheeler
On Fri, Jun 16, 2017, 23:32 Frank Pinto  wrote:

> I'm building an app that needs to do the following things: a) checks a
> Google Sheet for email and name of a client, b) logs into a dropbox account
> and downloads some files (only those files with the name from the google
> sheet), c) does some work on the files d) sends the new files to the
> clients with the information from the google sheets. It needs to do this
> from the first moment it runs till 7:30 PM local time (using a while loop).
>
> The problem I'm having is that when it starts running, the first iteration
> runs fine. When it gets to the second, the google sheets function I created
> that accesses the data of the sheets does not work (even though it did the
> first time). The console yields the following error:
>
> "FileNotFoundError: [Errno 2] No such file or directory: 'client_id.json'"
>

My best guess is some of your code which you haven't shown us is calling
`os.chdir()` and then you're not moving back.

When I encounter this problem I usually mitigate it using a context manager
something like this:

@contextlib.contextmanager
def pushd(dir):
prev = os.getcwd()
os.chdir(dir)
yield
os.chdir(prev)

And then

with pushd(dir):
Stuff in the dir

This is weird, because the json file obviously is not moved in between
> runs. Here's an overview of the structure of the code:


But it is just a guess, as your intention has been mangled somewhere along
the way, and in any case the code seems to be missing parts.
-- 

--
Matt Wheeler
http://funkyh.at
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30565] PEP 538: silence locale coercion and compatibility warnings by default?

2017-06-17 Thread STINNER Victor

STINNER Victor added the comment:

As I wrote on python-dev, I would prefer no warning and no option to enable
warnings. But it's not my PEP, I would prefer that Nick makes a choice
here. Right now, my main worry is that my little (freebsd) buildbots are
still sick

--

___
Python tracker 

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



cx_Oracle 6.0rc1

2017-06-17 Thread Anthony Tuininga
What is cx_Oracle?

cx_Oracle is a Python extension module that enables access to Oracle
Database for Python 2.x and 3.x and conforms to the Python database API 2.0
specifications with a number of enhancements.


Where do I get it?
https://oracle.github.io/python-cx_Oracle

The easiest method to install cx_Oracle 6.0rc1 is via pip as in

python -m pip install cx_Oracle --upgrade --pre

Note that the --pre option is required since this is a prerelease.


What's new?

This release focused on correcting issues discovered over the past month
and polishing items in preparation for a production release. The full
release notes can be read here:

http://cx-oracle.readthedocs.io/en/latest/releasenotes.html#version-6-0-rc-1-june-2017

Please provide any feedback via GitHub issues (
https://github.com/oracle/python-cx_Oracle/issues).
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Google Sheets API Error

2017-06-17 Thread Frank Pinto
Hello,

I'm building an app that needs to do the following things: a) checks a
Google Sheet for email and name of a client, b) logs into a dropbox account
and downloads some files (only those files with the name from the google
sheet), c) does some work on the files d) sends the new files to the
clients with the information from the google sheets. It needs to do this
from the first moment it runs till 7:30 PM local time (using a while loop).

The problem I'm having is that when it starts running, the first iteration
runs fine. When it gets to the second, the google sheets function I created
that accesses the data of the sheets does not work (even though it did the
first time). The console yields the following error:

"FileNotFoundError: [Errno 2] No such file or directory: 'client_id.json'"

This is weird, because the json file obviously is not moved in between
runs. Here's an overview of the structure of the code:

def full():
global logo, plogo, plogow, plogoh, client, metadata, logo_path
inst = 1
logo_path = os.path.abspath('.\\logo\\p4.png')
client = dropbox.client.DropboxClient(X')
while datetime.datetime.now().time() <= datetime.time(19, 45):
if inst == 1:
custo = customers()
if len(custo) == 0:
pass
else:
metadata = client.metadata('/')
d_files = files()
send_f = pd.merge(d_files, custo, left_on='c_name', right_on='Nombre',
  how='inner')
dl_files(send_f, custo)
else:
temp = customers()
send = temp[~temp.isin(custo)].dropna()
custo = customers()
if len(send) == 0:
pass
else:
metadata = client.metadata('/')
d_files = files()
send_f = pd.merge(d_files, custo, left_on='c_name', right_on='Nombre',
  how='inner')
dl_files(send_f, send)
time.sleep(30)
inst += 1

The  'customers()' function that is giving me problems:

def customers():
scope = ['https://spreadsheets.google.com/feeds']
creds =
ServiceAccountCredentials.from_json_keyfile_name('client_id.json', scope)
client = gspread.authorize(creds)

sheet = client.open('RC').sheet1
c_list = sheet.get_all_records()
df = pd.DataFrame(c_list)
return df

I really have no idea why this is happening. Does anybody might have a clue?

Thank you,




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


ANN: HOMOPHONE-SP

2017-06-17 Thread Mok-Kong Shen


In classical crypto, homophonic substitution attempts to mitigate risks of
frequency analysis via employing one-to-many mappings of plaintext
characters to ciphertext characters instead of one-to-one mappings.
However, constraints of manual processing naturally very severely limit
the extent to which the flattening of the frequency distributions of the
ciphertext characters could be achieved, which obviously is on the other
hand a non-issue for computer processing. I have written a Python code
HOMOPHONE-SP for performing homophonic substitution (in combination
with transpositions) where, for obtaining higher security, the processing
of the individual plaintext characters is chained via borrowing an idea
from modern block ciphers. The software is available at
http://mok-kong-shen.de

M. K. Shen
--
https://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


[issue30692] Automatic upcast does not occur for custom classes

2017-06-17 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +amaury.forgeotdarc, belopolsky, meador.inge

___
Python tracker 

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



[issue30692] Automatic upcast does not occur for custom classes

2017-06-17 Thread Ranger Harke

New submission from Ranger Harke:

I have noticed that the automatic upcast mechanism which works for
standard ctypes types does not appear to work for custom types with
_as_parameter_ defined.

Consider the following example (written for Mac OS X but just change
the LoadLibrary call to test on a different OS):

# -- begin --
from ctypes import *

libc = cdll.LoadLibrary('/usr/lib/libc.dylib')

class Base(Structure): pass
class Derived(Base): pass
class Wrapper(object): pass

printf = libc.printf
printf.argtypes = [ c_char_p, POINTER(Base) ]
printf.restype = c_int

derived = Derived()
derived_ptr = pointer(derived)
derived_ptr_wrapper = Wrapper()
derived_ptr_wrapper._as_parameter_ = pointer(derived)

# Case 1 WORKS: Derived* is automatically upcast to Base* and passed to
#   printf
printf(b'%p\n', derived_ptr)

# Case 2 WORKS: The Wrapper can be explicitly upcast to a Base* and
#   passed to printf
printf(b'%p\n', cast(derived_ptr_wrapper, POINTER(Base)))

# Case 3 FAILS: Automatic upcast does NOT happen with the value in the
#   Wrapper: 'expected LP_Base instance instead of
#   LP_Derived'
printf(b'%p\n', derived_ptr_wrapper)
# -- end --

Here we have two types, Base which is a ctypes Structure, and Derived
which derives from Base. A pointer to Derived can be passed to a
function that expects a pointer to Base, and it will automatically be
upcast.

However, once the Wrapper type is introduced, which simply holds a
pointer to Derived in its _as_parameter_ attribute, the automatic
upcast no longer occurs. A manual upcast works, though.

I believe this may be related to #27803, but that is talking about
byref() whereas this is related to cast(). Perhaps the internal
mechanism is the same; certainly it sounds like a similar problem.

I've tested this in Python 2.7 and 3.6, and the result is the same.

Not sure if this is a bug or an enhancement request- filing it as
"behavior" for now since to me, this is something that I expected to
implicitly work.

Thanks!  - Ranger Harke.

--
components: ctypes
messages: 296245
nosy: rharke
priority: normal
severity: normal
status: open
title: Automatic upcast does not occur for custom classes
type: behavior
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue29755] python3 gettext.lgettext sometimes returns bytes, not string

2017-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



Basic: scikits.rsformats

2017-06-17 Thread Ramdayal Singh
How can I know what are the applications of scikits.rsformats?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29517] "Can't pickle local object" when uses functools.partial with method and args...

2017-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Since WeakSet never was pickleable, the difference perhaps in the use of 
WeakSet in asyncio. BaseEventLoop contains a WeakSet attribute since 3.6, this 
makes it non-pickleable.

I'm not sure this is a cause of the failure.

--
components: +Library (Lib)

___
Python tracker 

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



[issue30691] WeakSet is not pickleable

2017-06-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

WeakSet contains the __reduce__ method, but it isn't pickleable (and never 
was), because the pickle state contains the value of the __dict__ dict 
attribute which contains a reference to unpickleable local function _remove().

>>> pickle.dumps(weakref.WeakSet())
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: Can't pickle local object 'WeakSet.__init__.._remove'

I wondering whether WeakSet should be made pickleable or the __reduce__ method 
should be removed. __reduce__() can be used also for copying, but  there are no 
tests for this feature.

--
components: Library (Lib)
messages: 296243
nosy: georg.brandl, pitrou, rhettinger, serhiy.storchaka, twouters
priority: normal
severity: normal
status: open
title: WeakSet is not pickleable

___
Python tracker 

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



[issue13617] Reject embedded null characters in wchar* strings

2017-06-17 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



Re: How to calculate Value in (%) and than create new column with percentage of used time. (Python)

2017-06-17 Thread Terry Reedy

On 6/17/2017 1:04 AM, mc...@hotmail.com wrote:

I assigned the optimal time of 960min to x.

x=960.0


Then I assigned the time used 189min to y.

y=189.0


Then I divide the time used(y) by the optimal time(x) and multiply the answer 
by 100 and assign the answer to z.

z=(y/x)*100


The answer.

z

19.6875

For Python to give you an accurate answer you must include decimal points.
I hope this helps.


In Python 3, they do not matter here.
>>> (189/960)*100
19.6875

In 2.7:
>>> (189/960)*100
0
>>> from __future__ import division
>>> (189/960)*100
19.6875




--
Terry Jan Reedy

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


[issue30665] pass big values for arg to fcntl.ioctl

2017-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The FreeBSD [1], OpenBSD [2], and Solaris 10 [3] documentations specify the 
third argument of ioctl() as either an int or a pointer.

Passing a 64-bit long instead of a 32-bit int on big-endian platform can cause 
incorrect interpretation of an argument.

[1] https://www.freebsd.org/cgi/man.cgi?query=ioctl=2
[2] http://man.openbsd.org/ioctl.2
[3] https://docs.oracle.com/cd/E26505_01/html/816-5167/ioctl-2.html

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30665] pass big values for arg to fcntl.ioctl

2017-06-17 Thread Chris Fiege

Changes by Chris Fiege :


--
nosy: +cfi

___
Python tracker 

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



[issue13617] Reject embedded null characters in wchar* strings

2017-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue13617] Reject embedded null characters in wchar* strings

2017-06-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you update your patch Victor?

--

___
Python tracker 

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



[issue30565] PEP 538: silence locale coercion and compatibility warnings by default?

2017-06-17 Thread Nick Coghlan

Nick Coghlan added the comment:

By having the warnings always compiled in, but off by default, 
"PYTHONCOERCECLOCALE=warn" becomes a debugging tool for integration failures 
that we (or end users) suspect might be due to the locale coercion behaviour. 
It's essentially an even more esoteric variant of tools like "PYTHONINSPECT=1", 
"python -X faulthandler", "python -v", etc.

I already learned something myself based on updating the test cases to cover 
the opt-in warning model: I initially thought that when we set "LC_ALL=C" we'd 
get *both* warnings, but we don't (at least with glibc).

My working theory is that setting 'LC_ALL=C' causes 'setlocale(LC_CTYPE, 
"C.UTF-8")' to fail, even if there's otherwise a C.UTF-8 locale available. (I 
haven't conclusively proven that theory, but it's the most likely point for the 
locale coercion to be implicitly bypassed)

--

___
Python tracker 

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



[issue30263] regrtest: log the system load?

2017-06-17 Thread Jeremy Kloth

Changes by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue30672] PEP 538: Unexpected locale behaviour on Mac OS X

2017-06-17 Thread Nick Coghlan

Nick Coghlan added the comment:

For the case where POSIX is a distinct locale from the default C locale (rather 
than a simple alias), I'm leaning towards taking PEP 538 literally, and 
adjusting the affected test cases to assume that locale coercion *won't* happen 
for that case on Mac OS X.

I *think* we can check for the alias behaviourally by setting the "POSIX" 
locale and seeing if it reports itself back to us as "C", but if not, then I'll 
just add in a sys.platform check, and we can figure out a behavioural check 
later if the platform check turns out to cause problems.

--

___
Python tracker 

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



[issue30687] build.bat should locate msbuild.exe rather than vcvarsall.bat

2017-06-17 Thread Jeremy Kloth

Changes by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue30565] PEP 538: silence locale coercion and compatibility warnings by default?

2017-06-17 Thread INADA Naoki

INADA Naoki added the comment:

If this warnings are disabled by default, who enable it?
How about just remove them?

I'm OK to remove them all.
Since it's not ideal, nothing go worse than Python 3.6.

Additionally, if PEP 540 is accepted, we can use UTF-8 for
stdio and filesystem encoding even when there are no UTF-8 locale.

--

___
Python tracker 

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



[issue30690] ChainMap doesn't preserve the order of ordered mappings

2017-06-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Iterating ChainMap emits keys in mixed order even if all underlying mappings 
are ordered dicts (OrderedDict). Would be nice to keep the order more 
predictable.

This would solve issue30664. See also issue30689.

--
components: Library (Lib)
messages: 296237
nosy: eric.smith, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: ChainMap doesn't preserve the order of ordered mappings
type: enhancement
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



[issue30689] len() and iter() of ChainMap don't work with unhashable keys

2017-06-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

As documented ChainMap supports not just dicts, but mappings. A mapping can be 
implemented not only as a hash table, and mapping keys can be not hashable. But 
ChainMap.__len__ and ChainMap.__iter__ work only with hashable keys.

This may be considered just as a documentation issue. But I think it would be 
nice to add the support of unhashable keys in 3.7.

--
assignee: rhettinger
components: Library (Lib)
messages: 296236
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: len() and iter() of ChainMap don't work with unhashable keys
type: behavior
versions: Python 2.7, 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



Re: python and post gis question

2017-06-17 Thread Xristos Xristoou
Τη Παρασκευή, 16 Ιουνίου 2017 - 10:59:10 μ.μ. UTC+3, ο χρήστης Xristos Xristoou 
έγραψε:
> I have create a python script where use post gis queries to automate some 
> intersection tasks using postgis database.
> 
> in my database I have polygons,points and lines.
> 
> here my snippet code of my script :
> 
>  try:
> if str(geomtype) == 'point':
> geomtype = 1
> elif str(geomtype) == 'linestring':
> geomtype = 2
> elif str(geomtype) == 'polygon':
> geomtype = 3
> else:
> raise TypeError()
> sql = "\nDROP TABLE IF EXISTS {0}.{1};\nCREATE TABLE {0}.{1} AS (SELECT 
> {4},\n(st_dump(ST_CollectionExtract(st_intersection(dbgis.{2}.shape,dbgis.{3}.shape)::GEOMETRY(GEOMETRY,2345),{5}))).geom
>  AS shape\nFROM  dbgis.{2}, dbgis.{3} WHERE 
> st_intersects(dbgis.{2}.shape,dbgis.{3}.shape) AND {5}=3);\nCREATE INDEX 
> idx_{2}_{3}_{6} ON {0}.{1} USING GIST (shape);\nALTER TABLE {0}.{1} ADD 
> COLUMN id SERIAL;\nALTER TABLE {0}.{1} ADD COLUMN my_area double 
> precision;\nUPDATE {0}.{1} SET my_area = ST_AREA(shape::GEOMETRY);\nALTER 
> TABLE {0}.{1} ADD PRIMARY KEY (id);\nSELECT 
> pop_g_col('{0}.{1}'::REGCLASS);\nGRANT ALL ON {0}.{1} TO GROUP u_cl;\nGRANT 
> ALL ON {0}.{1} TO GROUP my_user;\n-- VACUUM ANALYZE 
> {0}.{1};\n".format(schema, table, tablea, tableb, selects, geomtype, id_gen())
> return sql
> this post gis sql query work nice but I need the new field where I want to 
> add my_area to create only for polygons layers.
> 
> that code create for all layers (lines,points,polygons) that field my_area if 
> layer is point or line then take value 0 I don't like that I don't need it.
> 
> how to change this code to create my_area only in polygons ?

what you mean where?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30688] support named Unicode escapes (\N{name}) in re

2017-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Regular Expressions
nosy: +ezio.melotti

___
Python tracker 

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



[issue30688] support named Unicode escapes (\N{name}) in re

2017-06-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
nosy: +mrabarnett, serhiy.storchaka
stage:  -> patch review

___
Python tracker 

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



[issue30688] support named Unicode escapes (\N{name}) in re

2017-06-17 Thread Jonathan Eunice

Changes by Jonathan Eunice :


--
pull_requests: +2311

___
Python tracker 

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



[issue30681] email.utils.parsedate_to_datetime() should return None when date cannot be parsed

2017-06-17 Thread Tim Bell

Tim Bell added the comment:

I've updated the pull request to incorporate Barry's suggestion of a new defect 
for this situation, InvalidDateDefect.

--

___
Python tracker 

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



[issue30688] support named Unicode escapes (\N{name}) in re

2017-06-17 Thread Jonathan Eunice

New submission from Jonathan Eunice:

The re module specially handles Unicode escapes (\u and \U) so that 
even raw strings (r'...') have symbolic Unicode characters. But it has not 
supported named Unicode escapes such as r'\N{EM DASH}', making the escapes for 
string literals and the escapes for regular expressions asymmetric

--
components: Library (Lib)
messages: 296234
nosy: jonathaneunice
priority: normal
severity: normal
status: open
title: support named Unicode escapes (\N{name}) in re
type: enhancement
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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-06-17 Thread Ned Deily

Ned Deily added the comment:


New changeset 0a794a3256b24ccf57b18ec9964f2367ac1f3d30 by Ned Deily in branch 
'3.6':
bpo-30038: add Misc/NEWS entry.
https://github.com/python/cpython/commit/0a794a3256b24ccf57b18ec9964f2367ac1f3d30


--

___
Python tracker 

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



[issue30565] PEP 538: silence locale coercion and compatibility warnings by default?

2017-06-17 Thread Nick Coghlan

Changes by Nick Coghlan :


--
pull_requests: +2310

___
Python tracker 

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



[issue30038] Race condition in how trip_signal writes to wakeup fd

2017-06-17 Thread Ned Deily

Changes by Ned Deily :


--
pull_requests: +2309

___
Python tracker 

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