I am writing a script that simply asks the google api for the latitudes and longitudes for a list of addresses read in from a csv file and outputs an html with the googlemap widget embedded. Further I hoped to run pyinstaller in order to make this into a .exe.
Running the code on my original conda environment it works fine however the .exe that pyinstaller creates is massive for such a small script (over 300mb). As such, I created a new virtual environment in which to work and have installed what I believe to be the bare minimum packages necessary and have rewritten the code to use as few packages as I am able which for the currently working portion of the code dropped it down considerably to just over 10 mb. (No numpy or pandas for me... ah well).
The code again works fine up until the final step:
from ipywidgets.embed import embed_minimal_html
embed_minimal_html("exporttest.html", None)
The above line should take any widgets, in particular the figure created from
fig = gmaps.figure(layout=figure_layout)
markers = gmaps.marker_layer(coordinates)
fig.add_layer(markers)
fig
Running the currently modified version in my original conda environment with all my of my usual packages installed this runs as expected without errors. Running on the virtual environment however on the mentioned lines I get the following key error:
KeyError Traceback (most recent call last)
c:\programdata\anaconda3\envs\synod_environ\lib\sre_parse.py in
parse_template(source, pattern)
1020 try:
-> 1021 this = chr(ESCAPES[this][1])
1022 except KeyError:
KeyError: '\\u'
During handling of the above exception, another exception occurred:
error Traceback (most recent call last)
<ipython-input-5-3359941239ab> in <module>
1 from ipywidgets.embed import embed_minimal_html
2
----> 3 embed_minimal_html("exporttest.html", None)
...
error: bad escape \u at position 0
(For clarification, key error has two slashes before the u, some frustration in getting this to post correctly)
As the code runs correctly in the one environment but not the other, I can only assume that I'm missing a package somewhere that ipywidgets requires, but running pip check
doesn't notify me of anything missing.
pip list
returns the following packages:
altgraph 0.16.1 backcall 0.1.0 bleach 3.0.2 certifi 2018.10.15 chardet 3.0.4 colorama 0.4.0 decorator 4.3.0 defusedxml 0.5.0 entrypoints 0.2.3 future 0.17.1 geojson 2.4.1 gmaps 0.8.2 idna 2.7 ipykernel 5.1.0 ipython 7.1.1 ipython-genutils 0.2.0 ipywidgets 7.4.2 jedi 0.13.1 Jinja2 2.10 jsonschema 2.6.0 jupyter 1.0.0 jupyter-client 5.2.3 jupyter-console 6.0.0 jupyter-core 4.4.0 macholib 1.11 MarkupSafe 1.0 mistune 0.8.4 nbconvert 5.4.0 nbformat 4.4.0 notebook 5.7.0 pandocfilters 1.4.2 parso 0.3.1 pefile 2018.8.8 pickleshare 0.7.5 pip 10.0.1 prometheus-client 0.4.2 prompt-toolkit 2.0.7 Pygments 2.2.0 PyInstaller 3.4 python-dateutil 2.7.5 pywin32-ctypes 0.2.0 pywinpty 0.5.4 pyzmq 17.1.2 qtconsole 4.4.2 requests 2.20.0 Send2Trash 1.5.0 setuptools 40.4.3 six 1.11.0 terminado 0.8.1 testpath 0.4.2 tornado 5.1.1 traitlets 4.3.2 urllib3 1.24 wcwidth 0.1.7 webencodings 0.5.1 wheel 0.32.2 widgetsnbextension 3.4.2 wincertstore 0.2
Any thoughts on how to further identify what went wrong, what package might be missing or how to fix the issue, and/or alternate ways to save a googlemaps output?