我正在跟踪检索和排名教程,所有事情都很好,直到train.py脚本-我得到了错误"ValueError:没有JSON对象可以解码“
我带着面具的命令行:
python ./train.py -u "zzzz":"ssss" -i /Users/nik/Downloads/cranfield_gt.csv -c "zzzz" -x example_collection -n "example_ranker"结果:
Input file is /Users/nik/Downloads/cranfield_gt.csv
Solr cluster is zzzz
Solr collection is example_collection
Ranker name is example_ranker
Rows per query 10
Generating training data...
Command:
curl -k -s -u zzzz:ssss -d "q=what similarity laws must be obeyed when constructing aeroelastic models of heated high speed aircraft.>=184,3,29,3,31,3,12,2,51,2,102,2,13,1,14,1,15,1,57,3,378,3,859,3,185,2,30,2,37,2,52,1,142,1,195,1,875,3,56,2,66,2,95,2,462,1,497,2,858,2,876,2,879,2,880,2,486,0&generateHeader=true&rows=10&returnRSInput=true&wt=json" "https://gateway.watsonplatform.net/retrieve-and-rank/api/v1/solr_clusters/zzzz/solr/example_collection/fcselect"
Response:
Traceback (most recent call last):
File "./train.py", line 88, in <module>
parsed_json = json.loads(output)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded知道我为什么会犯这个错误,最重要的是如何解决它?
谢谢你,尼克
发布于 2016-05-03 22:06:09
好的,这是那些深夜的经历之一。我确信我上传了我的cranfield_data.json文件,但是今天的检查显示我没有,今天运行脚本再次上传它,并看到确认是关键。
在那之后,我重复了train.py,一切都成功了!
我希望这对其他人也有帮助。
顺便说一句,在上传之前,我第一次尝试更新和重新编译curl。似乎我并没有将它配置为使用https,而且当我第一次执行curl上传cranfield_data.json时,我想我没有注意到它。今天,我看到了错误的“协议"https”不支持“,这帮助我理解了之前发生的事情。恢复我的mac上原来的卷曲解决了这个问题。
https://stackoverflow.com/questions/37014305
复制相似问题