0

This seems like a really simple issue. I installed folium just fine but I get a syntax error in my program on the import statement.

Traceback (most recent call last):
  File "/home/python_scripts/interactivemap.py", line 3, in <module>
    import folium as f
  File "/usr/lib/python2.6/site-packages/folium/__init__.py", line 6, in <module>
    from folium.folium import Map, initialize_notebook
  File "/usr/lib/python2.6/site-packages/folium/folium.py", line 23, in <module>
    from folium import utilities
  File "/usr/lib/python2.6/site-packages/folium/utilities.py", line 235
    json_data = [{type_check(x): type_check(y) for x, y in iteritems(data)}]
                                                 ^
SyntaxError: invalid syntax

I'm really lost as to what could be causing this except maybe the fact that I'm running python 2.6 but I didn't see anything indicating an issue like this.

pythonismyjam
  • 99
  • 1
  • 10

1 Answers1

0

As you are using Python 2.6, you'll need to manually create the dictionary:

d = dict()

for k,v in iteritems(data):  # Not sure where you got
                             # this method from
    d[type_check(k)] = type_check(v)

json_data = [d] # or import simplejson as json; json_data = json.dumps(d)
Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284