You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to assign string directly to popup using master branch #259
I would get this error: AttributeError: 'str' object has no attribute 'get_name'. If I change that to popup=folium.Popup('test') it works fine. Is that intended?
Main reason I'm asking is because it seems somewhat tedious having to call that to assign a string to the popup.
changed the title [-]Unable to assign string to popup using master branch[/-][+]Unable to assign string directly to popup using master branch[/+]on Nov 27, 2015
Is that intended?
Main reason I'm asking is because it seems somewhat tedious having to call that to assign a string to the popup.
In the background, we cannot do without the Popup object, because one may be willing to create more complicated popups (with a vega chart for instance).
But I agree it's tedious, and in the foreground we can shortcut things in the Marker code to catch cases when the arg popup is a str (or bytes), and to replace it by Popup(popup).
It'd be great if you did a PR for that (and thus join the happy community of contributors). Otherwise, I'll do it on Monday.
I'm looking at that right now. Would it be better to change each marker individually since the error rises at map.py on line 389 for Marker and element.py on line 414 for CircleMarker etc...
They all have element.py line 46 in common which is where the exception is actually being called from. What would be the preference in this case?
I imagine you can simply fix it in the Marker.__init__ is testing when isinstance(popup,text_type) or isinstance(popup,str_type) and then overwrite the popup attribute.
Activity
[-]Unable to call popup using master branch[/-][+]Unable to assign string to popup using master branch[/+][-]Unable to assign string to popup using master branch[/-][+]Unable to assign string directly to popup using master branch[/+]BibMartin commentedon Nov 27, 2015
@jelmelk
In the background, we cannot do without the
Popupobject, because one may be willing to create more complicated popups (with a vega chart for instance).But I agree it's tedious, and in the foreground we can shortcut things in the
Markercode to catch cases when the argpopupis astr(orbytes), and to replace it byPopup(popup).It'd be great if you did a PR for that (and thus join the happy community of contributors). Otherwise, I'll do it on Monday.
jelmelk commentedon Nov 27, 2015
I'm looking at that right now. Would it be better to change each marker individually since the error rises at
map.pyon line 389 forMarkerandelement.pyon line 414 forCircleMarkeretc...They all have
element.pyline 46 in common which is where the exception is actually being called from. What would be the preference in this case?BibMartin commentedon Nov 27, 2015
I imagine you can simply fix it in the
Marker.__init__is testing whenisinstance(popup,text_type) or isinstance(popup,str_type)and then overwrite the popup attribute.themiurgo commentedon Nov 30, 2015
We should strive to generalise this, while we're at it. You might want to have a popup also for Polylines, for example.
BibMartin commentedon Dec 6, 2015
Fixed by #283. Closing this.