zhikrullah / pyshp

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

Reader fails for unicode strings #40

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. sf = shapefile.Reader(u'C:\\Test\\MyFile.shp')

What is the expected output? What do you see instead?

Expected to get a new Reader class. Instead get:

ShapefileException("Shapefile Reader requires a shapefile or file-like object.")

What version of the product are you using? On what operating system?

version: 1.1.4
Seems to be the same code in the trunk. 

Please provide any additional information below.

It fails due to the type checking in the __init__ function of the reader, as a 
string and unicode strings are different types. 
Is type checking necessary at all here?

if type(args[0]) is type("stringTest"): 

>>> type("hello")
<type 'str'>
>>> type(u"hello")
<type 'unicode'>

Original issue reported on code.google.com by geograph...@gmail.com on 21 Nov 2012 at 9:05

GoogleCodeExporter commented 8 years ago

Original comment by jlawh...@geospatialpython.com on 2 May 2013 at 4:58

GoogleCodeExporter commented 8 years ago
Fixed in version 1.1.7. Check is now done with shapefile.is_string() method 
originally added for Python 3 compatibility.

Original comment by geospati...@gmail.com on 23 Jun 2013 at 7:50