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
fix: folium.folium.Map._to_png()의 Firefox path related errors
fix: folium.folium.Map._to_png()의 Firefox path related errors
[Problem]
When the `folium.folium.Map._to_png()` method is used in an environment where the Firefox web browser is not installed, the following error is output.
[Example]
```
WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
```
[Solution]
Added a Boolean argument called `chrome` to the `folium.folium.Map._to_png()` method. If this value is `False`, Firefox webdriver is used as before, and if this value is `True`, Chrome webdriver is used. Additionally, we used the `webdriver_manager` package, which automatically installs chromedriver considering the version of the Chrome web browser installed on the client.
[Test]
- Legacy error-generating logic
```python
import io
import folium
from PIL import Image
m = folium.Map(location = [37.53, 127.054],
zoom_start = 14)
img_data = m._to_png(5)
img = Image.open(io.BytesIO(img_data))
```
- Logic applied to the solution
```python
import io
import folium
from PIL import Image
m = folium.Map(location = [37.53, 127.054],
zoom_start = 14)
img_data = m._to_png(delay=5,
chrome=True)
img = Image.open(io.BytesIO(img_data))
```
0 commit comments