Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing to only one shapefile type throwing an error #237

Closed
mem00 opened this issue Feb 28, 2022 · 2 comments
Closed

Writing to only one shapefile type throwing an error #237

mem00 opened this issue Feb 28, 2022 · 2 comments
Labels

Comments

@mem00
Copy link

mem00 commented Feb 28, 2022

w = shapefile.Writer(shp="/path/tofile.shp")

as per the documentation

w = shapefile.Writer(dbf='shapefiles/test/onlydbf.dbf')
w.field('field1', 'C')

throws

ShapefileException: No file-like object available.

when trying to write a polygon

w.poly(geometry)

@karimbahgat
Copy link
Collaborator

karimbahgat commented Mar 11, 2022

I was able to reproduce your error. We did have unit tests for this usecase that created a writer, but the error only happens when trying to add the first shape which we didn't do in the test. Will get this fixed for the next release, though if you're able to submit a PR that will be faster.

@karimbahgat
Copy link
Collaborator

Fixed the error and the tests, should be available in next version. Thanks for finding the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants