[issue29278] Python 3.6 build fails with parallel make

2017-01-14 Thread Utku Gultopu

New submission from Utku Gultopu:

Version Info

Linux 4.4.0-59-generic #80-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

Issue
=
When the multiple jobs option (`make -j`) is specified, build fails after 
compiling the `structmember.c` file. Subsequent compilation attempts show the 
following message:

gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.

--
components: Build
messages: 285503
nosy: ugultopu
priority: normal
severity: normal
status: open
title: Python 3.6 build fails with parallel make
type: compile error
versions: Python 3.6

___
Python tracker 

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



[issue22302] Windows os.path.isabs UNC path bug

2017-01-14 Thread Eryk Sun

Changes by Eryk Sun :


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

___
Python tracker 

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



[issue22302] Windows os.path.isabs UNC path bug

2017-01-14 Thread Eryk Sun

Changes by Eryk Sun :


--
stage:  -> needs patch
versions: +Python 3.6, Python 3.7 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2017-01-14 Thread Michael Felt

Michael Felt added the comment:

Ok. I shall rebuild from scratch.

When I do, I start from a "clean" system - only the compiler and my mkinstallp 
helper script.

I am adding the latest zlib for what I would package but I shall forgoe that 
for this test.

--

___
Python tracker 

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



Re: multiprocessing.Process call blocks other processes from running

2017-01-14 Thread Steve D'Aprano
On Sun, 15 Jan 2017 05:46 am, Rodrick Brown wrote:

> at some point the forking was working

Then whatever you changed, you should change back to the way it was.

That's the most important lesson here: never make two or more unrelated
changes to a program unless you have a backup of the working file.

An excellent way to manage this process is by using a revision control
system like Mercurial (hg) or equivalent. But at the very least, whenever
you change a working program, you should confirm it is still working before
making the next change.





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: How can I make a sentinel value NOT be initialized in a class/method - OOP?

2017-01-14 Thread Erik
[Replying to direct email. David - please respond to the list so that 
you can receive other people's suggestions also]


Hi David,

On 14/01/17 15:30, David D wrote:
> 1)  No this is not homework, I am doing this all on my own.

In that case I apologise - I gave you the benefit of the doubt though as 
I was only half-suspicious. FWIW, listing specific constructs that must 
be used is often a thing that a tutor would write in an assignment 
(because the purpose of the assignment is to get you to learn about 
those particular constructs). That's what raised the flag for me. Anyway ...


> 2) I am changing the class to cars.
>
> 3) A second question arose that I thought would work, but I am getting
> this error :*can't assign to a function call*
>
> What I am trying to do is this pseudo code :

Firstly, there's little point in posting pseudo code if you are 
reporting a specific compiler or run-time error. The errors you get are 
very specific to your code and in some cases are caused by *subtle* 
things in your code. We generally need to see the actual code (or a 
cut-down example) that allows the subtleties to be described to you.


> count= 0
>
> class car
> initialize all of the values and put self so they are available to the
> entire class
> def __init__(self, model...)
>   self.mode=model etc
>
>
> while loop
> input model =what is the model
> input serial = what is the serial
> input doors = how many doors
> count = count + 1
> #create the instance/object
> mycar (count) = car(model, serial, doors)
>
> input do you want another car in the database?
> if yes
>   continue
> if no
>   break
>
> The issue is that when creating an object/instance, python won't let me
> use this syntax of having -- car(count) which would give me multiple
> objects (car1, car2, car3 etc) with the count variable.  I am not 
sure why.


The syntax "foo(spam)" will *call* the function "foo" and pass it the 
value "spam". It doesn't make any sense to _assign a value_ to a 
function call operation (you're effectively trying to assign a value - 
the thing after the '=' - to another value - the return value of the 
function call).


So, what is "mycar"? How do you create it?

In Python, the built-in structure for a group of objects which can be 
dynamically extended with new entries in the way you want is a list. 
Create an empty one with:


mycar = []

or

mycar = list()

Lists have an 'append()' method which will add the parameter it is 
called with to the end of the list object it is called on:


mycar.append(car(model, serial, doors))


You don't have to worry about keeping track of 'count'. Lists will grow 
dynamically as you add things. Use "len(mycar)" to see how many items it 
holds and "for vehicle in mycar:" to step through them all or "mycar[n]" 
to address as specific entry.


From the Python prompt, type "help(list)"

Hope that helps.
E.
--
https://mail.python.org/mailman/listinfo/python-list


[issue29248] os.readlink fails on Windows

2017-01-14 Thread Craig Holmquist

Craig Holmquist added the comment:

New patch with test.

I'm not sure if C:\Users\All Users and C:\ProgramData exist with those names on 
non-English installations of Windows.  I set the test to skip if they aren't 
found.

--
nosy: +craigh
Added file: http://bugs.python.org/file46293/issue29248-2.patch

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-14 Thread INADA Naoki

INADA Naoki added the comment:

transmogrify.h uses hack to share docstring.
I can't find straightforward way.

--

___
Python tracker 

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



[issue23407] os.walk always follows Windows junctions

2017-01-14 Thread Eryk Sun

Eryk Sun added the comment:

Craig, can you add a patch for issue 29248, including a test based on the "All 
Users" link?

--
dependencies: +os.readlink fails on Windows

___
Python tracker 

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



Re: multiprocessing.Process call blocks other processes from running

2017-01-14 Thread MRAB

On 2017-01-14 19:05, Joseph L. Casale wrote:

 while True:
   for client in clients:
 stats = ThreadStats()
 stats.start()
 p = Process(target=getWhispererLogsDirSize, args=(client,queue,))
 jobs.append(p)
 p.start()
 p.join()


You start one client then join before starting the next...

Start them all and push the pointer the resulting process object into a 
collection.
Then use whatever semantics you desire to wait them all...


To me it also looks slightly odd that you're creating a ThreadStats
instance each time around the loop, and the only other reference to it
is to the last one created, and that line's indentation puts it outside
the """if __name__ == '__main__':""" block.

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


[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2017-01-14 Thread INADA Naoki

INADA Naoki added the comment:

Updated patch for unicodeobject.

@taleinat, could you confirm it?

--
nosy: +inada.naoki
Added file: http://bugs.python.org/file46292/unicodeobject.c.v6.patch

___
Python tracker 

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



[issue29256] Windows select() errors out when given no fds to select on, which breaks SelectSelector

2017-01-14 Thread Eryk Sun

Eryk Sun added the comment:

Some WinSock functions are just dispatchers that call a provider function. The 
dispatch table is set up when WinSock (i.e. ws2_32.dll) calls the WSPStartup 
function [1] of a provider DLL (e.g. mswsock.dll). In the case of select(), it 
calls the socket provider's WSPSelect function [2]. It determines the provider 
from the first socket found in the order of readfds, writefds, and exceptfds. 
It fails if there isn't at least one socket from which it can determine the 
provider. Also, given this design, each socket in all three sets has to be from 
the same provider. 

In general, using a dummy socket isn't a good workaround for using select() to 
implement a sleep function. WSPSelect can't be interrupted (or rather, it can 
only be interrupted temporarily to execute an asynchronous procedure call 
that's queued to the thread via QueueUserAPC, after which it resumes waiting). 
If a script uses select() with a dummy socket to sleep on the main thread, the 
user won't be able to cancel the wait with Ctrl+C. It would be better in this 
case if select.select waited on the SIGINT event like the Windows 
implementation of time.sleep.

[1]: https://msdn.microsoft.com/en-us/library/ms742296
[2]: https://msdn.microsoft.com/en-us/library/ms742289

--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



RE: multiprocessing.Process call blocks other processes from running

2017-01-14 Thread Joseph L. Casale
>  while True:
>for client in clients:
>  stats = ThreadStats()
>  stats.start()
>  p = Process(target=getWhispererLogsDirSize, args=(client,queue,))
>  jobs.append(p)
>  p.start()
>  p.join()

You start one client then join before starting the next...

Start them all and push the pointer the resulting process object into a 
collection.
Then use whatever semantics you desire to wait them all...

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


multiprocessing.Process call blocks other processes from running

2017-01-14 Thread Rodrick Brown
I'm trying to implement a script that tracks how much space certain
applications are using and send a metric to a statsd service for realtime
analysis however when running this code it nots forking multiple processes
its still running sequential at some point the forking was working but I
can't seem to figure out where I went wrong please advise

I'm just trying to keep track of the growth rate of certain dirs these dirs
have hundreds of thousands of files and take sometime to run I use du as it
runs much faster than os.walk() and it also returns the correct compressed
size on the file system pythons getsize() does not.

Thanks.

from datadog import initialize
from datadog import api
from datadog import statsd
import os
import subprocess
from import Process, Queue
from datadog import ThreadStats
import time
import datetime
from hashlib import md5

options = {
  'api_key': 'xx',
  'app_key': 'xx'
}

def getWhispererLogsDirSize(clientcfg, queue):
  clientName, logPath = clientcfg.items()[0]
  totalSize = 0
  clientResult = {}
  for item in os.listdir(logPath):
logDir = logPath + "/" + item
try:
  totalSize = totalSize +
int(subprocess.check_output(["du","-s",logDir]).split('\t')[0])
except subprocess.CalledProcessError:
  print("Error processing {0} skipping.".format(logDir))
  continue
  clientResult[clientName] = [os.path.basename(logPath),totalSize]
  queue.put(clientResult)
  return

if __name__ == '__main__':

  title = 'Whisperer client marketdata usage'
  text = 'This simple utility sends whisperer logs into datadog based on
client usage on disk'
  tags = ['version:1']
  initialize(**options)
  #api.Event.create(title=title, text=text, tags=tags)
  #stats = ThreadStats()
  #stats.start()
  queue = Queue()
  jobs = []
  clients = [
{'xx1':'/mnt/auto/glusterfs/app/NYC01-xx-PROD-01'},
{'xx2':'/mnt/auto/glusterfs/app/NYC01-xx-PROD-01'},
{'xx3':'/mnt/auto/glusterfs/app/NYC01-xx-PROD-01'},
{'xx4':'/mnt/auto/glusterfs/app/NYC01-xx-PROD-01'}
  ]
  tags = []
  while True:
for client in clients:
  stats = ThreadStats()
  stats.start()
  p = Process(target=getWhispererLogsDirSize, args=(client,queue,))
  jobs.append(p)
  p.start()
  p.join()
  clientinfo = queue.get()

  clientName = clientinfo.values()[0][0]
  clientPath = clientinfo.keys()[0]
  clientLogSize = clientinfo.values()[0][1]
  tags = [clientName,clientPath]
  aggregation_key = md5(clientName).hexdigest()

  print(clientName, clientPath, clientLogSize)
  with open('/tmp/dogstatd_out.log', 'a+') as fp:
fp.write("{0} {1} {2}
{3}\n".format(str(datetime.datetime.now()),clientName, clientPath,
clientLogSize))

stats.gauge('whisperer.marketdata.clientlogsize',int(clientLogSize),tags=tags)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: geopandas bug ?

2017-01-14 Thread Xristos Xristoou
Τη Σάββατο, 14 Ιανουαρίου 2017 - 8:09:53 μ.μ. UTC+2, ο χρήστης duncan smith 
έγραψε:
> On 14/01/17 14:59, Xristos Xristoou wrote:
> > Τη Σάββατο, 14 Ιανουαρίου 2017 - 4:38:39 μ.μ. UTC+2, ο χρήστης duncan smith 
> > έγραψε:
> >> On 14/01/17 11:18, Xristos Xristoou wrote:
> >>> i want  to create a simple spatial joing using geopandas but i thing so 
> >>> geopandas has bug ?
> >>>
> >>>
> >>>
> >>> geopandas code :
> >>>
> >>> from geopandas import gpd
> >>> import geopandas
> >>> points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc
> >>> polys = geopandas.GeoDataFrame.from_file('polygons.shp')
> >>> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >>>
> >>> error :
> >>>
> >>> Traceback (most recent call last):
> >>>   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py", 
> >>> line 7, in 
> >>> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >>>   File "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py", 
> >>> line 57, in sjoin
> >>> r_idx = np.concatenate(idxmatch.values)
> >>> ValueError: need at least one array to concatenate
> >>>
> >>> and if i change the imports with the some code :
> >>>
> >>> import geopandas
> >>> import pandas as pd
> >>> import geopandas as gpd
> >>> from geopandas import GeoDataFrame, read_file
> >>> from geopandas.tools import sjoin
> >>> from shapely.geometry import Point, mapping,shape
> >>> import pandas as gpd
> >>>
> >>> i take that error :
> >>>
> >>> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >>> AttributeError: 'module' object has no attribute 'sjoin'
> >>>
> >>>
> >>> any idea why ?
> >>>
> >>
> >>
> >> import geopandas as gpd
> >> import pandas as gpd
> >>
> >> Does pandas have an attribute 'sjoin'?
> >>
> >> Duncan
> > 
> > i dont know i follow detais i am newbie
> > 
> 
> You import geopandas as gpd, then import pandas as gpd. So maybe you
> think gpd refers to geopandas while it actually refers to pandas. I
> don't know geopandas or pandas, but you should check your imports.
> 
> Duncan

@Duncan i see that and i remove line with pandas ans no change
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29275] time module still has Y2K issues note

2017-01-14 Thread SilentGhost

SilentGhost added the comment:

The main message there is about the parsing of the two-digit year, so while it 
might worth it to remove the mention of Y2K, it would only be a minor change.

--
nosy: +SilentGhost

___
Python tracker 

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



Re: geopandas bug ?

2017-01-14 Thread duncan smith
On 14/01/17 14:59, Xristos Xristoou wrote:
> Τη Σάββατο, 14 Ιανουαρίου 2017 - 4:38:39 μ.μ. UTC+2, ο χρήστης duncan smith 
> έγραψε:
>> On 14/01/17 11:18, Xristos Xristoou wrote:
>>> i want  to create a simple spatial joing using geopandas but i thing so 
>>> geopandas has bug ?
>>>
>>>
>>>
>>> geopandas code :
>>>
>>> from geopandas import gpd
>>> import geopandas
>>> points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc
>>> polys = geopandas.GeoDataFrame.from_file('polygons.shp')
>>> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>>>
>>> error :
>>>
>>> Traceback (most recent call last):
>>>   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py", line 
>>> 7, in 
>>> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>>>   File "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py", 
>>> line 57, in sjoin
>>> r_idx = np.concatenate(idxmatch.values)
>>> ValueError: need at least one array to concatenate
>>>
>>> and if i change the imports with the some code :
>>>
>>> import geopandas
>>> import pandas as pd
>>> import geopandas as gpd
>>> from geopandas import GeoDataFrame, read_file
>>> from geopandas.tools import sjoin
>>> from shapely.geometry import Point, mapping,shape
>>> import pandas as gpd
>>>
>>> i take that error :
>>>
>>> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>>> AttributeError: 'module' object has no attribute 'sjoin'
>>>
>>>
>>> any idea why ?
>>>
>>
>>
>> import geopandas as gpd
>> import pandas as gpd
>>
>> Does pandas have an attribute 'sjoin'?
>>
>> Duncan
> 
> i dont know i follow detais i am newbie
> 

You import geopandas as gpd, then import pandas as gpd. So maybe you
think gpd refers to geopandas while it actually refers to pandas. I
don't know geopandas or pandas, but you should check your imports.

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


[issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags

2017-01-14 Thread Ari

Ari added the comment:

Sorry, it was a false alarm. I had a poorly constructed testcase. I was trying 
to grab all image links from html markup while simultaneously substituting 
image links to somesite.com with links to anothersite.com. I had 
handle_starttag and handle_startendtag defined in my class, but all the image 
processing resided in handle_starttag, and I didn't realize that 
handle_starttag is not automatically called when handle_startendtag is 
executed. So http://somesite.com/small_image.jpg; width="800px" /> 
went straight to handle_startendtag, and it did nothing to process the image 
link because handle_starttag was never called. When I removed 
handle_startendtag definition, I got the link I wanted (but the absense of 
handle_startendtag totally mangled the markup I was trying to produce).

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags

2017-01-14 Thread Brendan Donegan

Brendan Donegan added the comment:

I even get the correct behaviour in 2.7.12:
Python 2.7.12+ (default, Sep 17 2016, 12:08:02) 
[GCC 6.2.0 20160914] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from HTMLParser import HTMLParser
>>> class MyHTMLParser(HTMLParser):
... def handle_starttag(self, tag, attrs):
... print("Encountered a start tag: %s" % tag)
... 
>>> parser = MyHTMLParser()
>>> parser.feed('http://somesite.com/large_image.jpg;>>> src="http://somesite.com/small_image.jpg; width="800px" />')
Encountered a start tag: a
Encountered a start tag: img

Ari, can you provide more info about the exact version and platform you are 
using?

--
nosy: +brendan-donegan

___
Python tracker 

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



Re: geopandas bug ?

2017-01-14 Thread Peter Otten
Xristos Xristoou wrote:

> Τη Σάββατο, 14 Ιανουαρίου 2017 - 6:33:54 μ.μ. UTC+2, ο χρήστης Peter Otten
> έγραψε:
>> Xristos Xristoou wrote:
>> 
>> >> I suggest that you file a bug report.
>> > 
>> > Mr.Peter Otten do you see my shapefiles ?have instersection 100 to 100
>> > i use instersection on QGIS ad work fine
>> 
>> Yes, I downloaded the zipfile at
>> 
>> > https://www.dropbox.com/s/2693nfi248z0y9q/files.zip?dl=0 with the
>> 
>> and when I ran your code I got the very error that you saw. There are
>> many NaN values in your data, so if it works elsewhere perhaps the data
>> is corrupted in some way. I'm sorry I cannot help you any further.
>> 
>> Good luck!
> 
> one more question,i have a idea what is wrong,but if my code work how to
> export spatial join "pointInPoly" to new shapefile ?

You can find an object's methods in the interactive interpreter with dir()

>>> dir(pointInPoly)
['T', '_AXIS_ALIASES', '_AXIS_IALIASES', '_AXIS_LEN', '_AXIS_NAMES', 
'_AXIS_NUMBERS', '_AXIS_ORDERS', '_AXIS_REVERSED', '_AXIS_SLICEMAP', 



'rmod', 'rmul', 'rotate', 'rpow', 'rsub', 'rtruediv', 'save', 'scale', 
'select', 'set_geometry', 'set_index', 'set_value', 'shape', 'shift', 
'simplify', 'sindex', 'skew', 'sort', 'sort_index', 'sortlevel', 'squeeze', 
'stack', 'std', 'sub', 'subtract', 'sum', 'swapaxes', 'swaplevel', 
'symmetric_difference', 'tail', 'take', 'to_clipboard', 'to_crs', 'to_csv', 
'to_dense', 'to_dict', 'to_excel', 'to_file', 'to_gbq', 'to_hdf', 'to_html', 
'to_json', 'to_latex', 'to_msgpack', 'to_panel', 'to_period', 'to_pickle', 
'to_records', 'to_sparse', 'to_sql', 'to_stata', 'to_string', 
'to_timestamp', 'to_wide', 'total_bounds', 'touches', 'translate', 
'transpose', 'truediv', 'truncate', 'tshift', 'type', 'tz_convert', 
'tz_localize', 'unary_union', 'union', 'unstack', 'update', 'values', 'var', 
'where', 'within', 'xs']

OK, that's quite a lot, but to_file() seems to be a good candidate. Let's 
see what it does:

>>> help(pointInPoly.to_file)
Help on method to_file in module geopandas.geodataframe:

to_file(filename, driver='ESRI Shapefile', schema=None, **kwargs) metod of 
geopandas.geodataframe.GeoDataFrame instance
Write this GeoDataFrame to an OGR data source

A dictionary of supported OGR providers is available via:
>>> import fiona
>>> fiona.supported_drivers

Parameters
--
filename : string
File path or file handle to write to.
driver : string, default 'ESRI Shapefile'
The OGR format driver used to write the vector file.
schema : dict, default None
If specified, the schema dictionary is passed to Fiona to
better control how the file is written.

The *kwargs* are passed to fiona.open and can be used to write
to multi-layer data, store data within archives (zip files), etc.

Looks good, run it:

>>> pointInPoly.to_file("point_in_poly")

No error. Does it round-trip?

>>> pointInPoly == gpd.GeoDataFrame.from_file("point_in_poly")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/pandas/core/ops.py", line 875, in f
return self._compare_frame(other, func, str_rep)
  File "/usr/lib/python3/dist-packages/pandas/core/frame.py", line 2860, in 
_compare_frame
raise ValueError('Can only compare identically-labeled '
ValueError: Can only compare identically-labeled DataFrame objects

Ouch, unfortunately not. Upon further inspection:

>>> pip.columns
Index(['geometry', 'index_righ', 'name_left', 'name_right'], dtype='object')
>>> pointInPoly.columns
Index(['geometry', 'name_left', 'index_right', 'name_right'], 
dtype='object')

Looks like column names are either corrupted or limited to 10 characters by 
default. Again I don't know how to overcome this, but as a special service 
here's the first hit for 'shp file column name limit' on a popular search 
engine:

http://gis.stackexchange.com/questions/15784/how-to-bypass-10-character-limit-of-field-name-in-shapefiles

I'm out of this now.


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


[issue26865] Meta-issue: support of the android platform

2017-01-14 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Current status:
---

Available using the pyona build system [1]:
  * Cross compilation of Python for a given Android API level and architecture 
with android-ndk-r13b.
  * Cross compilation of third party extension modules (currently as a patch).
  * Interactive interpreter with curses and readline support, the Android adb 
(remote) shell is used to start the interpreter on the qemu emulator or a 
device connected with USB.
  * Remote debugging with gdb and support of the python-gdb module.
  * The adb shell is used to start a run of the test suite on the emulator or a 
device.

To be defined for the support of the Android platform:
  * Support starting with which Python release ?
 sys.getandroidapilevel() has been defined in Python 3.7 by issue 28740, so 
unless this enhancement is backported to 3.6 the first release to support 
Android could be 3.7.
  * What is the supported Android API level(s) [2] ?
 Level 21 is the first to provide a reliable wide character support.
 Level 24 is the most recent api level currently supported by the NDK and 
is the first where the adb shell is run as the 'shell' user instead of as 
'root' and as a consequence, where the test suite must now cope with Android 
SELinux non permitted operations (hard link, mkfifo, mknod, bind on a unix 
socket).
  * On which architecture(s) ?
 The x86 platform is useful for testing and debugging as it runs fast on 
the Android qemu emulator.
 AFAIK the armv7 platform is still one of the most widespread Android 
platforms [3] [4].
  * Building with which NDK version ?
 The next android-ndk-r14 release is the first to provide "Unified 
headers", see issue #29040.
  * The buildbots run the test suite on the Android qemu emulator or on a 
device or both ?

Test suite results on the Android qemu emulator:
  test_builtin is excluded in all the tests - test_asyncio is excluded on 
armv7-android-api-21.
  x86 platform (duration: about 27 minutes, to be compared with 26 minutes when 
the test suite is run natively on the same laptop).
api 21: success
api 24: success
  armv7 platform (duration: about 410 minutes. Without the latest released 
libffi-3.2.1 that does not build on armv7).
api 21: success
api 24: success

Remaining issues:
1) Blocker issues:
  test_builtin:
issue #13886: failure when test_readline is run before test_builtin.
  This problem is not specific to Android.
  test_asyncio:
issue #26858: android: setting SO_REUSEPORT fails
  Failure only on armv7 at api 21.

2) Issues with a patch tested successfully on x86 and armv7 at Android api 21 
and 24:
  Build:
issue #28833: cross compilation of third-party extension modules.
  PermissionError raised at api 24:
test_eintr test_genericpath test_pathlib test_posix test_shutil test_stat
  issue #28759: access to mkfifo, mknod and hard links is controled by 
SELinux MAC on Android
test_os:
  issue #29180: skip tests that raise PermissionError in test_os (non-root 
user on Android)
test_tarfile:
  issue #29181: skip tests that raise PermissionError in test_tarfile 
(non-root user on Android)
test_socketserver:
  issue #29184: skip tests of test_socketserver when bind() raises 
PermissionError (non-root user on Android)
test_distutils:
  issue #29185: test_distutils fails on Android api 24
test_asyncio:
  issue #28684: [asyncio] bind() on a unix socket raises PermissionError on 
Android for a non-root user.
  Miscellaneous:
test_asyncio:
  issue #28562: test_asyncio fails on Android upon calling getaddrinfo().
test_readline:
  issue #28997: test_readline.test_nonascii fails on Android.
test_curses:
  issue #29176: /tmp does not exist on Android and is used by 
curses.window.putwin()

3) Enhancement issues:
  issue #26855: android: add platform.android_ver().
  issue #27659: Prohibit implicit C function declarations.
  issue #29040: building Android with android-ndk-r14.

4) Languishing issues:
  issue #22724: byte-compile fails for cross-builds.
  issue #27606: Android cross-built for armv5te with clang and '-mthumb' 
crashes with SIGSEGV or SIGILL.
  issue #26852: add the '--enable-sourceless-distribution' option to configure.
  issue #27640: add the '--disable-test-suite' option to configure.

[1] https://bitbucket.org/xdegaye/pyona
[2] Andoid versions:
  Android Version  ReleasedAPI Level  Name
  Android 7.1  October 201625 Nougat
  Android 7.0  August 2016 24 Nougat
  Android 6.0  August 2015 23 Marshmallow
  Android 5.1  March 2015  22 Lollipop
  Android 5.0  November 2014   21 Lollipop
  Android 4.4W June 2014   20 Kitkat Watch
  Android 4.4  October 201319 Kitkat
  Android 4.3  July 2013   18 Jelly Bean
  

[issue29277] os.getcwd failing on LOFS share

2017-01-14 Thread miniflow

New submission from miniflow:

I am calling os.getcwd and am occasionally seeing failures inside my program.  
This is not due to files missing as the files on the share are static.

Eror is:

[Errno 2] No such file or directory

Which is definitely not the case.

Can any sort of trace be done at the time of failure to detect if the issue is 
with python or the OS?

System is running Debian inside of an Illumos LX zone.

--
components: IO, Library (Lib)
messages: 285492
nosy: David Terk
priority: normal
severity: normal
status: open
title: os.getcwd failing on LOFS share
type: crash
versions: Python 2.7, Python 3.4

___
Python tracker 

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



[issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags

2017-01-14 Thread Xiang Zhang

Xiang Zhang added the comment:

I can get the expected behaviour with the lastest 2.7 build.

Python 2.7.13+ (2.7:0d4e0a736688, Jan 15 2017, 00:51:57) 
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from HTMLParser import HTMLParser
>>> class MyHTMLParser(HTMLParser):
... def handle_starttag(self, tag, attrs):
... print 'Encountered a start tag: %s' % tag
... 
>>> parser = MyHTMLParser()
>>> parser.feed('http://somesite.com/large_image.jpg;>>> src="http://somesite.com/small_image.jpg; width="800px" />')
Encountered a start tag: a
Encountered a start tag: img

--
nosy: +xiang.zhang

___
Python tracker 

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



Re: geopandas bug ?

2017-01-14 Thread Xristos Xristoou
Τη Σάββατο, 14 Ιανουαρίου 2017 - 6:33:54 μ.μ. UTC+2, ο χρήστης Peter Otten 
έγραψε:
> Xristos Xristoou wrote:
> 
> >> I suggest that you file a bug report.
> > 
> > Mr.Peter Otten do you see my shapefiles ?have instersection 100 to 100 i
> > use instersection on QGIS ad work fine
> 
> Yes, I downloaded the zipfile at
> 
> > https://www.dropbox.com/s/2693nfi248z0y9q/files.zip?dl=0 with the
> 
> and when I ran your code I got the very error that you saw. There are many 
> NaN values in your data, so if it works elsewhere perhaps the data is 
> corrupted in some way. I'm sorry I cannot help you any further. 
> 
> Good luck!

one more question,i have a idea what is wrong,but if my code work how to export 
spatial join "pointInPoly" to new shapefile ?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: geopandas bug ?

2017-01-14 Thread Peter Otten
Xristos Xristoou wrote:

>> I suggest that you file a bug report.
> 
> Mr.Peter Otten do you see my shapefiles ?have instersection 100 to 100 i
> use instersection on QGIS ad work fine

Yes, I downloaded the zipfile at

> https://www.dropbox.com/s/2693nfi248z0y9q/files.zip?dl=0 with the

and when I ran your code I got the very error that you saw. There are many 
NaN values in your data, so if it works elsewhere perhaps the data is 
corrupted in some way. I'm sorry I cannot help you any further. 

Good luck!

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


Re: geopandas bug ?

2017-01-14 Thread Xristos Xristoou
Τη Σάββατο, 14 Ιανουαρίου 2017 - 6:01:39 μ.μ. UTC+2, ο χρήστης Peter Otten 
έγραψε:
> Xristos Xristoou wrote:
> 
> > Τη Σάββατο, 14 Ιανουαρίου 2017 - 4:30:48 μ.μ. UTC+2, ο χρήστης Peter Otten
> > έγραψε:
> >> Xristos Xristoou wrote:
> >> 
> >> > Τη Σάββατο, 14 Ιανουαρίου 2017 - 3:43:10 μ.μ. UTC+2, ο χρήστης Peter
> >> > Otten έγραψε:
> >> >> Xristos Xristoou wrote:
> >> >> 
> >> >> > i want  to create a simple spatial joing using geopandas but i thing
> >> >> > so geopandas has bug ?
> >> >> 
> >> >> Have you tried the examples on
> >> >> ? Do they work? If yes, inspect
> >> >> your data, does it have the same format?
> >> 
> >> Looks like you chose to ignore the hard part.
> >>  
> >> >> > geopandas code :
> >> >> > 
> >> >> > from geopandas import gpd
> >> >> > import geopandas
> >> >> > points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson
> >> >> > etc polys = geopandas.GeoDataFrame.from_file('polygons.shp')
> >> >> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >> >> > 
> >> >> > error :
> >> >> > 
> >> >> > Traceback (most recent call last):
> >> >> >   File
> >> >> >   "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py",
> >> >> >   line 7, in 
> >> >> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >> >> >   File
> >> >> >   "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py",
> >> >> >   line 57, in sjoin
> >> >> > r_idx = np.concatenate(idxmatch.values)
> >> >> > ValueError: need at least one array to concatenate
> >> 
> >> >> > any idea why ?
> >> >> 
> >> >> My crystal ball says that either points or polys is empty ;)
> >> > 
> >> > is not empty and yes i have two shapefiles from qgis.
> >> 
> >> Can I download those files somewhere?
> >> 
> >> > what is the error ?
> >> 
> >> No idea. Without those files I cannot run your code.
> > 
> > https://www.dropbox.com/s/2693nfi248z0y9q/files.zip?dl=0 with the
> > shapefiles
> 
> It looks like there are no intersections in your data.
> With the proviso that I've learned about the library only today I think you 
> should get an empty result set rather than the ValueError.
> Here's a way to reproduce the error (?) with the data provided in the 
> project:
> 
> import geopandas
> from geopandas import gpd
> 
> world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
> cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
> countries = world[['geometry', 'name']]
> 
> def find(items, name):
> # didn't find the idomatic way quickly, so
> for index, n in enumerate(items["name"]):
> if n == name:
> return items[index:index+1]
> raise ValueError
> 
> berlin = find(cities, "Berlin")
> paris = find(cities, "Paris")
> germany = find(countries, "Germany")
> 
> print(gpd.sjoin(berlin, germany))
> print(gpd.sjoin(paris, germany)) # ValueError
>  
> $ python demo.py
> geometry name_left  index_right  \
> 175  POINT (13.39960276470055 52.52376452225116)Berlin   41   
> 
> name_right  
> 175Germany  
> 
> [1 rows x 4 columns]
> Traceback (most recent call last):
>   File "demo.py", line 20, in 
> print(gpd.sjoin(paris, germany)) # ValueError
>   File "/home/peter/virt/geopandas/lib/python3.4/site-
> packages/geopandas/tools/sjoin.py", line 57, in sjoin
> r_idx = np.concatenate(idxmatch.values)
> ValueError: need at least one array to concatenate
> $
> 
> I suggest that you file a bug report.

Mr.Peter Otten do you see my shapefiles ?have instersection 100 to 100 i use 
instersection on QGIS ad work fine
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: geopandas bug ?

2017-01-14 Thread Peter Otten
Xristos Xristoou wrote:

> Τη Σάββατο, 14 Ιανουαρίου 2017 - 4:30:48 μ.μ. UTC+2, ο χρήστης Peter Otten
> έγραψε:
>> Xristos Xristoou wrote:
>> 
>> > Τη Σάββατο, 14 Ιανουαρίου 2017 - 3:43:10 μ.μ. UTC+2, ο χρήστης Peter
>> > Otten έγραψε:
>> >> Xristos Xristoou wrote:
>> >> 
>> >> > i want  to create a simple spatial joing using geopandas but i thing
>> >> > so geopandas has bug ?
>> >> 
>> >> Have you tried the examples on
>> >> ? Do they work? If yes, inspect
>> >> your data, does it have the same format?
>> 
>> Looks like you chose to ignore the hard part.
>>  
>> >> > geopandas code :
>> >> > 
>> >> > from geopandas import gpd
>> >> > import geopandas
>> >> > points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson
>> >> > etc polys = geopandas.GeoDataFrame.from_file('polygons.shp')
>> >> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>> >> > 
>> >> > error :
>> >> > 
>> >> > Traceback (most recent call last):
>> >> >   File
>> >> >   "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py",
>> >> >   line 7, in 
>> >> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>> >> >   File
>> >> >   "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py",
>> >> >   line 57, in sjoin
>> >> > r_idx = np.concatenate(idxmatch.values)
>> >> > ValueError: need at least one array to concatenate
>> 
>> >> > any idea why ?
>> >> 
>> >> My crystal ball says that either points or polys is empty ;)
>> > 
>> > is not empty and yes i have two shapefiles from qgis.
>> 
>> Can I download those files somewhere?
>> 
>> > what is the error ?
>> 
>> No idea. Without those files I cannot run your code.
> 
> https://www.dropbox.com/s/2693nfi248z0y9q/files.zip?dl=0 with the
> shapefiles

It looks like there are no intersections in your data.
With the proviso that I've learned about the library only today I think you 
should get an empty result set rather than the ValueError.
Here's a way to reproduce the error (?) with the data provided in the 
project:

import geopandas
from geopandas import gpd

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
countries = world[['geometry', 'name']]

def find(items, name):
# didn't find the idomatic way quickly, so
for index, n in enumerate(items["name"]):
if n == name:
return items[index:index+1]
raise ValueError

berlin = find(cities, "Berlin")
paris = find(cities, "Paris")
germany = find(countries, "Germany")

print(gpd.sjoin(berlin, germany))
print(gpd.sjoin(paris, germany)) # ValueError
 
$ python demo.py
geometry name_left  index_right  \
175  POINT (13.39960276470055 52.52376452225116)Berlin   41   

name_right  
175Germany  

[1 rows x 4 columns]
Traceback (most recent call last):
  File "demo.py", line 20, in 
print(gpd.sjoin(paris, germany)) # ValueError
  File "/home/peter/virt/geopandas/lib/python3.4/site-
packages/geopandas/tools/sjoin.py", line 57, in sjoin
r_idx = np.concatenate(idxmatch.values)
ValueError: need at least one array to concatenate
$

I suggest that you file a bug report.


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


[issue29276] HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link tags

2017-01-14 Thread Ari

New submission from Ari:

The following code produces incorrect results under Python 2.7.13. One would 
expect it to print 2 lines, "Encountered a start tag: a" and "Encountered a 
start tag: img". Yet it prints only "Encountered a start tag: a".

from HTMLParser import HTMLParser
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print 'Encountered a start tag: %s' % tag
parser = MyHTMLParser()
parser.feed('http://somesite.com/large_image.jpg;>http://somesite.com/small_image.jpg; width="800px" />')


Python 3.5.2 produces correct results on the same input and prints the expected 
"Encountered a start tag: a" and "Encountered a start tag: img".

from html.parser import HTMLParser
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print("Encountered a start tag:", tag)
parser = MyHTMLParser()
parser.feed('http://somesite.com/large_image.jpg;>http://somesite.com/small_image.jpg; width="800px" />')

--
components: Library (Lib)
messages: 285490
nosy: Ari
priority: normal
severity: normal
status: open
title: HTMLParser in Python 2.7 doesn't recognize image tags wrapped up in link 
tags
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue29275] time module still has Y2K issues note

2017-01-14 Thread Elizabeth Myers

Changes by Elizabeth Myers :


--
type:  -> enhancement

___
Python tracker 

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



[issue29275] time module still has Y2K issues note

2017-01-14 Thread Elizabeth Myers

New submission from Elizabeth Myers:

It's 2017. I think it's time to remove the Y2K warning from this: 
https://docs.python.org/3/library/time.html :P. It's 17 years past the sell-by 
date for that notice.

--
assignee: docs@python
components: Documentation
messages: 285489
nosy: Elizacat, docs@python
priority: normal
severity: normal
status: open
title: time module still has Y2K issues note
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



[issue23407] os.walk always follows Windows junctions

2017-01-14 Thread Craig Holmquist

Craig Holmquist added the comment:

New patch with spaces instead of tabs

--
Added file: http://bugs.python.org/file46291/issue23407-4.patch

___
Python tracker 

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



[issue29248] os.readlink fails on Windows

2017-01-14 Thread Craig Holmquist

Changes by Craig Holmquist :


--
keywords: +patch
Added file: http://bugs.python.org/file46290/issue29248.patch

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2017-01-14 Thread David Edelsohn

David Edelsohn added the comment:

Michael, you need to build from scratch. The values are set and tweaked in 
various phases of configure and then written to _sysconfigdata.py for 
installation.

The values in the file reflect the values used during the build, but many of 
them are not used in an installed version of Python.

Three important phases are:

1) Building modules in the tree during the build process.
2) In-tree testing of build module feature.
3) Building and installing modules with an installed version of Python.

The initial configuration scripts must match the location where the export 
files will be installed. And the _sysconfigdata.py definitions used to build 
external modules in an installed version of Python must refer to the proper 
location.

All of the pieces are interconnected and must be tested in a wholistic manner. 
A partial rebuild does not test the impact of the patch.

--

___
Python tracker 

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



Re: geopandas bug ?

2017-01-14 Thread Xristos Xristoou
Τη Σάββατο, 14 Ιανουαρίου 2017 - 4:38:39 μ.μ. UTC+2, ο χρήστης duncan smith 
έγραψε:
> On 14/01/17 11:18, Xristos Xristoou wrote:
> > i want  to create a simple spatial joing using geopandas but i thing so 
> > geopandas has bug ?
> > 
> > 
> > 
> > geopandas code :
> > 
> > from geopandas import gpd
> > import geopandas
> > points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc
> > polys = geopandas.GeoDataFrame.from_file('polygons.shp')
> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> > 
> > error :
> > 
> > Traceback (most recent call last):
> >   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py", line 
> > 7, in 
> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >   File "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py", 
> > line 57, in sjoin
> > r_idx = np.concatenate(idxmatch.values)
> > ValueError: need at least one array to concatenate
> > 
> > and if i change the imports with the some code :
> > 
> > import geopandas
> > import pandas as pd
> > import geopandas as gpd
> > from geopandas import GeoDataFrame, read_file
> > from geopandas.tools import sjoin
> > from shapely.geometry import Point, mapping,shape
> > import pandas as gpd
> > 
> > i take that error :
> > 
> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> > AttributeError: 'module' object has no attribute 'sjoin'
> > 
> > 
> > any idea why ?
> > 
> 
> 
> import geopandas as gpd
> import pandas as gpd
> 
> Does pandas have an attribute 'sjoin'?
> 
> Duncan

i dont know i follow detais i am newbie
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: geopandas bug ?

2017-01-14 Thread Xristos Xristoou
Τη Σάββατο, 14 Ιανουαρίου 2017 - 4:30:48 μ.μ. UTC+2, ο χρήστης Peter Otten 
έγραψε:
> Xristos Xristoou wrote:
> 
> > Τη Σάββατο, 14 Ιανουαρίου 2017 - 3:43:10 μ.μ. UTC+2, ο χρήστης Peter Otten
> > έγραψε:
> >> Xristos Xristoou wrote:
> >> 
> >> > i want  to create a simple spatial joing using geopandas but i thing so
> >> > geopandas has bug ?
> >> 
> >> Have you tried the examples on ?
> >> Do they work? If yes, inspect your data, does it have the same format?
> 
> Looks like you chose to ignore the hard part.
>  
> >> > geopandas code :
> >> > 
> >> > from geopandas import gpd
> >> > import geopandas
> >> > points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson
> >> > etc polys = geopandas.GeoDataFrame.from_file('polygons.shp')
> >> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >> > 
> >> > error :
> >> > 
> >> > Traceback (most recent call last):
> >> >   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py",
> >> >   line 7, in 
> >> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >> >   File
> >> >   "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py",
> >> >   line 57, in sjoin
> >> > r_idx = np.concatenate(idxmatch.values)
> >> > ValueError: need at least one array to concatenate
> 
> >> > any idea why ?
> >> 
> >> My crystal ball says that either points or polys is empty ;)
> > 
> > is not empty and yes i have two shapefiles from qgis.
> 
> Can I download those files somewhere?
> 
> > what is the error ?
> 
> No idea. Without those files I cannot run your code.

https://www.dropbox.com/s/2693nfi248z0y9q/files.zip?dl=0 with the shapefiles
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue23407] os.walk always follows Windows junctions

2017-01-14 Thread Craig Holmquist

Craig Holmquist added the comment:

Here's a new patch:  now, _Py_attribute_data_to_stat and Py_DeleteFileW will 
just use the IsReparseTagNameSurrogate macro to determine if the file is a 
link, so os.walk etc. will know not to follow them.  os.readlink, however, will 
only work with junctions and symbolic links; otherwise it will raise ValueError 
with "unsupported reparse tag".

This way, there's a basic level of support for all name-surrogate tags, but 
os.readlink only works with the ones whose internal structure is (semi-) 
documented.

--
Added file: http://bugs.python.org/file46289/issue23407-3.patch

___
Python tracker 

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



[issue26296] colorsys rgb_to_hls algorithm error

2017-01-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> The modulus fixes it for exact numbers.  It doesn't produce exactly the same 
> result with floats, because of rounding.  Is that a problem?

I don't think that is a problem. The function uses a number of floating point 
operations producing inexact intermediate values. There is not an evidence that 
the proposed code produces more accurate value.

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-14 Thread INADA Naoki

INADA Naoki added the comment:

I've created pull request about it:
https://github.com/haypo/cpython/pull/1

--

___
Python tracker 

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



[issue29262] Provide a way to check for *real* typing.Union instances

2017-01-14 Thread Evan

Evan added the comment:

I'm also interested in this. I've been using 'thing.__origin__ is 
typing.Union', but this doesn't work in some of the older versions of typing.

--
nosy: +evan_

___
Python tracker 

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



Re: geopandas bug ?

2017-01-14 Thread duncan smith
On 14/01/17 11:18, Xristos Xristoou wrote:
> i want  to create a simple spatial joing using geopandas but i thing so 
> geopandas has bug ?
> 
> 
> 
> geopandas code :
> 
> from geopandas import gpd
> import geopandas
> points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc
> polys = geopandas.GeoDataFrame.from_file('polygons.shp')
> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> 
> error :
> 
> Traceback (most recent call last):
>   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py", line 
> 7, in 
> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>   File "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py", 
> line 57, in sjoin
> r_idx = np.concatenate(idxmatch.values)
> ValueError: need at least one array to concatenate
> 
> and if i change the imports with the some code :
> 
> import geopandas
> import pandas as pd
> import geopandas as gpd
> from geopandas import GeoDataFrame, read_file
> from geopandas.tools import sjoin
> from shapely.geometry import Point, mapping,shape
> import pandas as gpd
> 
> i take that error :
> 
> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> AttributeError: 'module' object has no attribute 'sjoin'
> 
> 
> any idea why ?
> 


import geopandas as gpd
import pandas as gpd

Does pandas have an attribute 'sjoin'?

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


Re: geopandas bug ?

2017-01-14 Thread Xristos Xristoou
Τη Σάββατο, 14 Ιανουαρίου 2017 - 4:30:48 μ.μ. UTC+2, ο χρήστης Peter Otten 
έγραψε:
> Xristos Xristoou wrote:
> 
> > Τη Σάββατο, 14 Ιανουαρίου 2017 - 3:43:10 μ.μ. UTC+2, ο χρήστης Peter Otten
> > έγραψε:
> >> Xristos Xristoou wrote:
> >> 
> >> > i want  to create a simple spatial joing using geopandas but i thing so
> >> > geopandas has bug ?
> >> 
> >> Have you tried the examples on ?
> >> Do they work? If yes, inspect your data, does it have the same format?
> 
> Looks like you chose to ignore the hard part.
>  
> >> > geopandas code :
> >> > 
> >> > from geopandas import gpd
> >> > import geopandas
> >> > points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson
> >> > etc polys = geopandas.GeoDataFrame.from_file('polygons.shp')
> >> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >> > 
> >> > error :
> >> > 
> >> > Traceback (most recent call last):
> >> >   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py",
> >> >   line 7, in 
> >> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >> >   File
> >> >   "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py",
> >> >   line 57, in sjoin
> >> > r_idx = np.concatenate(idxmatch.values)
> >> > ValueError: need at least one array to concatenate
> 
> >> > any idea why ?
> >> 
> >> My crystal ball says that either points or polys is empty ;)
> > 
> > is not empty and yes i have two shapefiles from qgis.
> 
> Can I download those files somewhere?
> 
> > what is the error ?
> 
> No idea. Without those files I cannot run your code.

yes i sent you
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: geopandas bug ?

2017-01-14 Thread Peter Otten
Xristos Xristoou wrote:

> Τη Σάββατο, 14 Ιανουαρίου 2017 - 3:43:10 μ.μ. UTC+2, ο χρήστης Peter Otten
> έγραψε:
>> Xristos Xristoou wrote:
>> 
>> > i want  to create a simple spatial joing using geopandas but i thing so
>> > geopandas has bug ?
>> 
>> Have you tried the examples on ?
>> Do they work? If yes, inspect your data, does it have the same format?

Looks like you chose to ignore the hard part.
 
>> > geopandas code :
>> > 
>> > from geopandas import gpd
>> > import geopandas
>> > points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson
>> > etc polys = geopandas.GeoDataFrame.from_file('polygons.shp')
>> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>> > 
>> > error :
>> > 
>> > Traceback (most recent call last):
>> >   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py",
>> >   line 7, in 
>> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>> >   File
>> >   "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py",
>> >   line 57, in sjoin
>> > r_idx = np.concatenate(idxmatch.values)
>> > ValueError: need at least one array to concatenate

>> > any idea why ?
>> 
>> My crystal ball says that either points or polys is empty ;)
> 
> is not empty and yes i have two shapefiles from qgis.

Can I download those files somewhere?

> what is the error ?

No idea. Without those files I cannot run your code.

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


Re: geopandas bug ?

2017-01-14 Thread Xristos Xristoou
Τη Σάββατο, 14 Ιανουαρίου 2017 - 3:43:10 μ.μ. UTC+2, ο χρήστης Peter Otten 
έγραψε:
> Xristos Xristoou wrote:
> 
> > i want  to create a simple spatial joing using geopandas but i thing so
> > geopandas has bug ?
> 
> Have you tried the examples on ?
> Do they work? If yes, inspect your data, does it have the same format?
> 
> > geopandas code :
> > 
> > from geopandas import gpd
> > import geopandas
> > points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc
> > polys = geopandas.GeoDataFrame.from_file('polygons.shp')
> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> > 
> > error :
> > 
> > Traceback (most recent call last):
> >   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py",
> >   line 7, in 
> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> >   File "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py",
> >   line 57, in sjoin
> > r_idx = np.concatenate(idxmatch.values)
> > ValueError: need at least one array to concatenate
> > 
> > and if i change the imports with the some code :
> > 
> > import geopandas
> > import pandas as pd
> > import geopandas as gpd
> > from geopandas import GeoDataFrame, read_file
> > from geopandas.tools import sjoin
> > from shapely.geometry import Point, mapping,shape
> > import pandas as gpd
> > 
> > i take that error :
> > 
> > pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> > AttributeError: 'module' object has no attribute 'sjoin'
> > 
> > 
> > any idea why ?
> 
> My crystal ball says that either points or polys is empty ;)

is not empty and yes i have two shapefiles from qgis.what is the error ?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29240] Implementation of the PEP 540: Add a new UTF-8 mode

2017-01-14 Thread Eryk Sun

Eryk Sun added the comment:

> it should be replaced with sys.getfilesystemencodeerrors() 
> to support UTF-8 Strict mode.

I did that in the patch for issue 28188. The focus of the patch is to add bytes 
support on Windows for os.putenv and os.environb, but I also tried to maximize 
consistency (at least parallel structure) between the POSIX and Windows 
implementations.

--
nosy: +eryksun

___
Python tracker 

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



[issue29062] hashlib documentation link error

2017-01-14 Thread INADA Naoki

Changes by INADA Naoki :


--
status: open -> closed

___
Python tracker 

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



[issue29264] sparc/ffi.c:440 error: 'asm' undeclared

2017-01-14 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Since Python 3.6, building ctypes with bundled libffi is deprecated. Please 
build libffi separately and configure CPython with --with-system-ffi.

This issue can be closed as third-party.

--
nosy: +Chi Hsuan Yen

___
Python tracker 

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



Re: geopandas bug ?

2017-01-14 Thread Peter Otten
Xristos Xristoou wrote:

> i want  to create a simple spatial joing using geopandas but i thing so
> geopandas has bug ?

Have you tried the examples on ?
Do they work? If yes, inspect your data, does it have the same format?

> geopandas code :
> 
> from geopandas import gpd
> import geopandas
> points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc
> polys = geopandas.GeoDataFrame.from_file('polygons.shp')
> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> 
> error :
> 
> Traceback (most recent call last):
>   File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py",
>   line 7, in 
> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
>   File "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py",
>   line 57, in sjoin
> r_idx = np.concatenate(idxmatch.values)
> ValueError: need at least one array to concatenate
> 
> and if i change the imports with the some code :
> 
> import geopandas
> import pandas as pd
> import geopandas as gpd
> from geopandas import GeoDataFrame, read_file
> from geopandas.tools import sjoin
> from shapely.geometry import Point, mapping,shape
> import pandas as gpd
> 
> i take that error :
> 
> pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
> AttributeError: 'module' object has no attribute 'sjoin'
> 
> 
> any idea why ?

My crystal ball says that either points or polys is empty ;)


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


[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-14 Thread Eryk Sun

Eryk Sun added the comment:

Resolving this would be straightforward if we could use a subclass for the 
swapped type, but ctypes simple types behave differently for subclasses. A 
simple subclass doesn't automatically call the getfunc to get a converted value 
when returned as a function result, struct field, or array index.

--

___
Python tracker 

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



[issue29274] Change “tests cases” → “test cases”

2017-01-14 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +michael.foord

___
Python tracker 

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



[issue29125] Shell injection via TIX_LIBRARY when using tkinter.tix

2017-01-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

TclError in Terry's example is raised because Tcl script has unpaired braces. 
You should add "{" at the end of TIX_LIBRARY.

Here is working exploit:

$ TIX_LIBRARY="/dev/null}; exec python3 -m this >spoiled; set x {"  python3 -c 
"from tkinter.tix import Tk; Tk()"

It creates the file "spoiled" in current directory containing The Zen of Python.

--

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2017-01-14 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

I commented at the Rietveld, since I think that patch needs a bit more 
modification.

* rename PyThread_ReInitTLS
* update comments and messages that have explained CPython TLS API

--

___
Python tracker 

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



[issue29062] hashlib documentation link error

2017-01-14 Thread INADA Naoki

INADA Naoki added the comment:

Martin, thank you for pointing it out.
I hadn't know about suspicious check.

--

___
Python tracker 

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



[issue29062] hashlib documentation link error

2017-01-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ea0c488b9bac by INADA Naoki in branch '3.6':
Issue #29062: Doc: Fix make suspicious
https://hg.python.org/cpython/rev/ea0c488b9bac

New changeset 5c48fbe12cb8 by INADA Naoki in branch 'default':
Issue #29062: Doc: Fix make suspicious
https://hg.python.org/cpython/rev/5c48fbe12cb8

--

___
Python tracker 

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



[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-14 Thread Nick Coghlan

Nick Coghlan added the comment:

Yeah, re-using Python-level method objects in different types is genuinely 
invalid when combined with __class__ or zero-argument super(), as there's no 
way to make the __class__ closure refer to two different classes at runtime - 
it will always refer back to the original defining class.

And while ctypes could be updated to do the right thing for functions, 
classmethod, staticmethod, abstractmethod, property, etc, there's nothing 
systematic it can do that would work for arbitrary descriptors (any of which 
may have a zero-argument-super-using method definition hidden inside their 
internal state).

--

___
Python tracker 

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



[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-14 Thread Eryk Sun

Eryk Sun added the comment:

OK, this is completely broken and needs a more thoughtful solution than my 
simpleminded hack. Here's a practical example of the problem, tested in 3.5.2:

class MyInt(ctypes.c_int):
def __repr__(self):
return super().__repr__()

class Struct(ctypes.BigEndianStructure):
_fields_ = (('i', MyInt),)

>>> s = Struct()
>>> s.i
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 3, in __repr__
TypeError: super(type, obj): obj must be an instance or subtype of type

--

___
Python tracker 

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



geopandas bug ?

2017-01-14 Thread Xristos Xristoou
i want  to create a simple spatial joing using geopandas but i thing so 
geopandas has bug ?



geopandas code :

from geopandas import gpd
import geopandas
points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc
polys = geopandas.GeoDataFrame.from_file('polygons.shp')
pointInPoly = gpd.sjoin(points, polys, how='left',op='within')

error :

Traceback (most recent call last):
  File "/home/username/testshapely/sumpointsinsidepolygon/testgeo.py", line 7, 
in 
pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
  File "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py", line 
57, in sjoin
r_idx = np.concatenate(idxmatch.values)
ValueError: need at least one array to concatenate

and if i change the imports with the some code :

import geopandas
import pandas as pd
import geopandas as gpd
from geopandas import GeoDataFrame, read_file
from geopandas.tools import sjoin
from shapely.geometry import Point, mapping,shape
import pandas as gpd

i take that error :

pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
AttributeError: 'module' object has no attribute 'sjoin'


any idea why ?
-- 
https://mail.python.org/mailman/listinfo/python-list


geopandas bug ?

2017-01-14 Thread Xristos Xristoou
i want  to create a simple spatial joing using geopandas but i thing so 
geopandas has bug ?



geopandas code :

from geopandas import gpd
import geopandas
points = geopandas.GeoDataFrame.from_file('points.shp') # or geojson etc
polys = geopandas.GeoDataFrame.from_file('polygons.shp')
pointInPoly = gpd.sjoin(points, polys, how='left',op='within')

error :

Traceback (most recent call last):
  File "/home/sarantis/testshapely/sumpointsinsidepolygon/testgeo.py", line 7, 
in 
pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
  File "/usr/local/lib/python2.7/dist-packages/geopandas/tools/sjoin.py", line 
57, in sjoin
r_idx = np.concatenate(idxmatch.values)
ValueError: need at least one array to concatenate

and if i change the imports with the some code :

import geopandas
import pandas as pd
import geopandas as gpd
from geopandas import GeoDataFrame, read_file
from geopandas.tools import sjoin
from shapely.geometry import Point, mapping,shape
import pandas as gpd

i take that error :

pointInPoly = gpd.sjoin(points, polys, how='left',op='within')
AttributeError: 'module' object has no attribute 'sjoin'


any idea why ?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-14 Thread Dave Jones

Dave Jones added the comment:

I confess I'm going to have to read a bit more about Python internals before I 
can understand Eryk's analysis (this is my first encounter with "cell 
objects"), but many thanks for the rapid analysis and patch!

I'm not too concerned about the state being broken with reversed endianness; I 
don't think that's going to affect any of my use-cases in the near future, but 
it's certainly useful to know in case it does come up.

--

___
Python tracker 

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



[issue29125] Shell injection via TIX_LIBRARY when using tkinter.tix

2017-01-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In the original code, python interpolates tixlib into the string sent to and 
executed by tcl exec.  With the patch, tcl exec does the interpolation.  Not 
knowing anything in particular about tcl's exec, I found a value for tixlib 
that appears to validate Serhiy's claim that tcl exec does not rescan.

C:\Users\Terry>py -3.5
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter as tk
>>> tka = tk.Tk().tk
>>> txlib =  '} python -c "print(999)"'
>>> tka.setvar('TIX_LIBRARY', txlib)
>>> tka.eval('global autopath; lappend auto_path {%s}' % txlib)
Traceback (most recent call last):
  File "", line 1, in 
_tkinter.TclError: extra characters after close-quote

>>> tka.eval('global autopath; lappend auto_path $TIX_LIBRARY')
'{C:\\Programs\\Python35\\tcl\\tcl8.6} C:/Programs/Python35/tcl C:/Programs/lib 
C:/Programs/Python35/tcl/tk8.6 C:/Programs/Python35/tcl/tk8.6/ttk \\}\\ 
python\\ -c\\ \\"print(999)\\"'

I don't understand exactly why (or when) TclError is raised. but it is only 
raised when python does the interpolation.  And for this string, only when '}' 
is present.  Without the '}', there is no exception and the interpolated string 
is simply appended, as with the new $TIX_LIBRARY code.

test_tix, such as it is, passes with the patch.  So unless I missed something 
the patch appears to be both safe and useful.

--

___
Python tracker 

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



[issue15527] Double parens in functions references

2017-01-14 Thread Roundup Robot

Roundup Robot added the comment:

New changeset be4da80b493e by Martin Panter in branch '2.7':
Issue #15527: remove double parens by changing markup.
https://hg.python.org/cpython/rev/be4da80b493e

--

___
Python tracker 

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



Re: Announcement: TLSv1.2 will become mandatory in the future for Python.org Sites

2017-01-14 Thread dieter
oliver  writes:

> When I run this per email from my work laptop,
>
> python3 -c "import urllib.request,json;
> print(json.loads(urllib.request.urlopen('
> https://www.howsmyssl.com/a/check').read())['tls_version'])"
>
> I get the following traceback:
> ...
> File "c:\Python35\lib\ssl.py", line 633, in do_handshake
> self._sslobj.do_handshake()
> ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
> (_ssl.c:645)

I guess (!) that somehow the well known trusted CA (= "Certificate authority")
certificates are incomplete on your machine.

Certificate verification works as follows:
a certificate is always signed by a certificate authority ("CA");
for a certificate to be trusted, the signing CA must be trusted.
There may be several trust steps but finally, there must be
some "CA" that you are trusting "without further proof".
The certificates of those "CA"s are somewhere stored on your machine.

Apparently, the "https" servers you have problems with
are using a CA which is not declared trusted on your machine
(by installing the appropriate certificate at the correct place).

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


[issue29006] 2.7.13 _sqlite more prone to "database table is locked"

2017-01-14 Thread Armin Rigo

Armin Rigo added the comment:

larry: unless someone else comments, I think now that the current status of 
3.5.3 is fine enough (nothing was done in this branch, and the problem I 
describe and just fixed in PyPy can be left for later).

The revert dd13098a5dc2 needs to be itself reverted in the 2.7 branch.

--

___
Python tracker 

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



Re: Python Web Scrapping : Within href readonly those value that have href in it

2017-01-14 Thread Peter Otten
shahs...@gmail.com wrote:

> I am trying to scrape a webpage just for learning. In that webpage there
> are multiple "a" tags. consider the below code
> 
>  Something 
> 
>  Something

These are probaly all forward slashes.

> Now i want to read only those href in which there is http. My Current code
> is
> 
> for link in soup.find_all("a"):
> print link.get("href")
> 
> i would like to change it to read only http links.

You mean href values that start with "http://;?
While you can do that with a callback

def check_scheme(href):
return href is not None and href.startswith("http://;)

for a in soup.find_all("a", href=check_scheme):
print(a["href"])

or a regular expression

import re

for a in soup.find_all("a", href=re.compile("^http://;)):
print(a["href"])

why not keep things simple and check before printing? Like

for a in soup.find_all("a"):
href = a.get("href", "") # empty string if href is missing
if href.startswith("http://;):
print(href)


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


Re: Running Virtualenv with a custom distlib?

2017-01-14 Thread dieter
haraldnordg...@gmail.com writes:

> I want to do some development on `distlib`, and in the process run the code 
> via `virtualenv` which has distlib as a dependency.
>
> That is, not run the process inside a virtualenv, but run virtualenv's code 
> using a custom dependency. What are the steps I need to go through to achieve 
> this?

I would try to run "virtualenv" in a virtual environment with a "distlib"
seemingly to fulfill the "virtualenv" requirements but in fact be under
your control (e.g. set up via "python setup.py develop").

I do not know whether the virtual environment mentioned above can
be set up via "virtualenv" itself (that would be the easiest thing).
If not, I would install "python" from source and tweak its "site-packages"
as necessary.

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


Re: timers in threaded application

2017-01-14 Thread dieter
Skip Montanaro  writes:

> On Fri, Jan 13, 2017 at 3:23 AM, dieter  wrote:
>
>> If what you want to timeout are not I/O operations, you can have a
>> look at "threading.Timer". It uses a separate thread, lets it wait
>> a specified time and then starts a specified function, unless
>> "cancel"ed.
>>
>
> Ooh, hadn't considered that. That would seem to do the trick. I assume the
> function to be executed will be run in the timer's thread, so will have to
> suitably lock any shared data.

Yes.

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


[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-14 Thread Nick Coghlan

Nick Coghlan added the comment:

Eryk's diagnosis sounds right to me, and the suggested patch will get this back 
to working as well as it did in Python 3.5.

However, it's worth noting that that state itself was already broken when it 
comes to zero-argument super() support on the type definition with reversed 
endianness:

```
>>> import ctypes as ct
>>> class SuperText(ct.c_uint32):
... def __repr__(self):
... return super().__repr__()
... 
>>> SuperText.__ctype_le__(1)

>>> SuperText.__ctype_be__(1)
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 3, in __repr__
TypeError: super(type, obj): obj must be an instance or subtype of type
```

The apparently nonsensical error message comes from both the original type and 
the type with swapped endianness having the same representation:

>>> SuperText.__ctype_le__

>>> SuperText.__ctype_be__


--

___
Python tracker 

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