我有一个关于json.decoder.JSONDecodeError的问题:预期值:第1行第1列(字符0)

时间:2019-07-18 23:43:31

标签: folium

我正在用叶片设置交互式地图,我想用python导入json文件。我只是将整个代码复制到youtube教程中,但最终无法正常工作。

我真的不知道该怎么办,我是一个初学者。

import os
from folium import plugins

m = folium.Map(location=[14.676041, 121.043701], tiles="stamen terrain", zoom_start = 12.5)
floodsampleData = os.path.join('baha.json')

folium.GeoJson(floodsampleData, name='bahaaa')


m.save('roms.html')

print("lol")```

I'm getting error on ```folium.GeoJson(floodsampleData, name='bahaaa')``` and error shows ```Traceback (most recent call last):
  File "C:\Users\rdtd_ss12\Desktop\maptest\maptest2.py", line 8, in <module>
    folium.GeoJson(floodsampleData, name='bahaaa')
  File "C:\Users\rdtd_ss12\AppData\Local\Programs\Python\Python37-32\lib\site-packages\folium\features.py", line 450, in __init__
    self.data = self.process_data(data)
  File "C:\Users\rdtd_ss12\AppData\Local\Programs\Python\Python37-32\lib\site-packages\folium\features.py", line 486, in process_data
    return json.loads(f.read())
  File "C:\Users\rdtd_ss12\AppData\Local\Programs\Python\Python37-32\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\rdtd_ss12\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\rdtd_ss12\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```

0 个答案:

没有答案