简体   繁体   中英

Error: “ValueError: No JSON object could be decoded”

Following is my Simple JSON code which is showing the error: "ValueError: No JSON object could be decoded"

#!/usr/bin/env python
import json
import urllib2
data = urllib2.urlopen("http://192.168.5.1/getcommands.txt").read()
print data
d = json.loads(data)
print d

Please help me as am new to this.

My getcommands.txt contains following data and its also the output for print data: GetLocation Shutdown Reboot CleanData

My getcommands.txt contains following data and its also the output for print data: GetLocation Shutdown Reboot CleanData

That's very obviously not valid JSON .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM