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

OSError: when calling maps.map() #87

Open
dfloer opened this issue Sep 7, 2021 · 1 comment
Open

OSError: when calling maps.map() #87

dfloer opened this issue Sep 7, 2021 · 1 comment

Comments

@dfloer
Copy link

dfloer commented Sep 7, 2021

I'm getting OSError: [Errno 30] Read-only file system: when calling maps.map() to get a map image.
This is being run inside a container with a read-only filesystem.

It seems like there should at least be an exception raised from the GbifMap class. I don't know if this is intended to be a pure API library, but I don't expect an HTTP API wrapper to be saving files to my filesystem without me telling it to.

Versions:
Python: 3.8.12
pygbif: 0.6.0

@dfloer
Copy link
Author

dfloer commented Sep 7, 2021

As a workaround I monkey patched out the call to self.__write_file() in:

pygbif/pygbif/maps/map.py

Lines 187 to 195 in 1508ca9

def __init__(self, x):
super(GbifMap, self).__init__()
self.response = x
self.path = self.__make_path()
self.__write_file()
if has(self.response.headers["Content-Type"], "png"):
self.img = self.__prep_plot()
else:
self.img = None

like so (I also removed the plotting related calls as they're extraneous for an API, and caused other issues detailed in #89):

import pygbif as _pygbif

def new_init(self, x):
    super(_pygbif.maps.GbifMap, self).__init__()
    self.response = x
_pygbif.maps.GbifMap.__init__ = new_init

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

No branches or pull requests

1 participant