我的Python脚本:
import requests
import json
location = '127.0.0.1'
port = 8000
# Setup the REST API URL string
apiString = 'http://' + location + ':' + str(port) + '/edsa-Python/Matrix_mult_dynamic/run_python.php'
print apiString
#Make the REST API Request
resp = requests.get(apiString)
print resp.text
# print resp.encoding
# Get the JSON that is returned
if resp.status_code == requests.codes.ok:
the_json = resp.json()
#print the_json
错误:我得到一个错误,说没有JSON对象可以被解码。 下面是在命令提示符下运行python脚本时出现的错误:
http://127.0.0.1:8000/edsa-Python/Matrix_mult_dynamic/run_python.php
Traceback (most recent call last):
File "client_python.py", line 25, in <module>
the_json = resp.json()
File "C:\Python27\lib\site-packages\requests-2.12.0-py2.7.egg\requests\models.py", line 841, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Python27\lib\json\__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
目前没有回答
相关问题 更多 >
编程相关推荐