0
我試圖讓「轉換器」腳本jvectormap投入到工作中,但我收到以下錯誤,json.dumps和UnicodeDecodeError錯誤
ultural$ python ../../../../jvectormap/converter/converter.py --width 1000 --country_name_index 1 --country_code_index 30 --where "'ISO = DEU'" --projection aea --name datag_germany --language en_US ne_10m_admin_1_states_provinces_shp.shp here.js
ERROR 1: Not enough tokens to complete expression.
Traceback (most recent call last):
File "../../../../jvectormap/converter/converter.py", line 294, in <module>
converter.convert(args['output_file'])
File "../../../../jvectormap/converter/converter.py", line 182, in convert
open(outputFile, 'w').write(self.map.getJSCode())
File "../../../../jvectormap/converter/converter.py", line 30, in getJSCode
return "jQuery.fn.vectorMap('addMap', '"+self.name+"_"+self.projection['type']+"_"+self.language+"',"+json.dumps(map)+');'
File "/usr/lib/python2.6/json/__init__.py", line 230, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.6/json/encoder.py", line 367, in encode
chunks = list(self.iterencode(o))
File "/usr/lib/python2.6/json/encoder.py", line 309, in _iterencode
for chunk in self._iterencode_dict(o, markers):
File "/usr/lib/python2.6/json/encoder.py", line 275, in _iterencode_dict
for chunk in self._iterencode(value, markers):
File "/usr/lib/python2.6/json/encoder.py", line 309, in _iterencode
for chunk in self._iterencode_dict(o, markers):
File "/usr/lib/python2.6/json/encoder.py", line 273, in _iterencode_dict
yield encoder(key)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe1 in position 4: unexpected end of data
我在想,我應該如何處理json.dumps和編碼 - 這似乎是這種情況下的主要問題。我正在使用Python 2.6;