zhikrullah / pyshp

Automatically exported from code.google.com/p/pyshp
MIT License
0 stars 0 forks source link

Correct data type should be enforced when adding point data. #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Add point data in a non-number format (this is not very smart when doing it 
by hand, but easy to do when parsing data from an input file):
sf.point('12.23','14.24') 

2.Attempt to save the shapefile:
sf.save('shapefile')

3.See error that doesn't make a lot of sense:
 File "../../py_libs/pyShp/shapefile.py", line 492, in __shapefileHeader
    f.write(pack("<4d", *self.bbox()))
struct.error: required argument is not a float

It would be nice if when adding a point a legible error was thrown if the data 
was in a format that would work (such as accidentally adding numbers that are 
encoded as string values from a csv file)

Original issue reported on code.google.com by jwdal...@gmail.com on 12 Jan 2011 at 5:30

GoogleCodeExporter commented 8 years ago
Agreed.  That example is a very common use case and the exception as well as 
other similar possibilities are not easy to decipher. That exception will be 
handled with a more direct message.

Original comment by geospati...@gmail.com on 12 Jan 2011 at 2:43

GoogleCodeExporter commented 8 years ago
The latest version posted on 2-8-11 contains this fix

Original comment by geospati...@gmail.com on 11 Feb 2011 at 3:24

GoogleCodeExporter commented 8 years ago

Original comment by geospati...@gmail.com on 11 Feb 2011 at 3:25