IOError: cannot identify image file <StringIO.StringIO instance
dakmatt opened this issue · comments
Hi @dakmatt,
Thanks for sharing, I tried to reproduce with the following data based on your screenshot:
df = pd.DataFrame(
[
["JUMLAH", 790136, np.nan, np.nan],
["ALOR GAJAH", 173712, 2.382211, 102.211561],
["Ayer Pa'Abas", 2644, 2.396907, 102.166641],
],
columns=['label', 'size', 'latitude', 'longitude'],
)
mplt.plot_markers(df)
and it worked... except for the fact that the NaN
values lead to a weird marker on the map, I'll add that improvement to the backlog:
Could you share more so that I can reproduce your error?
I believe it is due to an unsuccessful query to Google APIs, which then return a wrong string (not an image basically) and Pillow fails to load it. Can't be 100% sure given the context though.
If I can reproduce it, I'm more than happy to add some verbose to the error, I acknowledge it's not very helpful at the moment!
Hope it helps,
Thomas
Added this issue to the board #4
Any luck @dakmatt ?
I can confirm that this happens when Google sends a "403" response code. For me, it meant that I forgot to enable the "static maps" API.
Ok thanks @rudolfbyker, I'll add some logic to handle the response codes.
I released version 1.0.6 on pypi with HTTP error handling, it should prevent this issue in the future.
Thanks for reporting!