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

more explicit NotImplementedError messages in read mode ? #1676

Closed
spolloni opened this issue May 1, 2019 · 2 comments
Closed

more explicit NotImplementedError messages in read mode ? #1676

spolloni opened this issue May 1, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@spolloni
Copy link

spolloni commented May 1, 2019

In wanting to set a GeoTIFF's CRS, I encountered this NotImplementedError when trying to run the following code:

with rasterio.open(filepath) as src:
    src.crs = "EPSG:3857"

Though in retrospect it is obvious the above will fail without explicitly specifying the proper mode , i.e. 'r+' in this case, I was momentarily thrown off by the error and assumed something was wrong with my approach. Would a more explicit error message be useful here?

@sgillies sgillies added the bug label May 13, 2019
@sgillies sgillies self-assigned this May 13, 2019
@sgillies sgillies added this to the 1.0.23 milestone May 13, 2019
@sgillies
Copy link
Member

If you open a file in "r" mode and try to set the encoding attribute of the file object, you'll see AttributeError: readonly attribute. I think we could do something like that.

@spolloni
Copy link
Author

@sgillies great! thanks for looking into this

sgillies pushed a commit that referenced this issue May 14, 2019
On attempts to modify datasets opened in read-only mode

Resolves #1676
sgillies pushed a commit that referenced this issue May 14, 2019
On attempts to modify datasets opened in read-only mode

Resolves #1676
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