Python3:无法从json.decoder导入JSONDecodeError

用户名

我使用python 3.4.3设置了virtualenv并尝试从json.decoder导入JSONDecodeError

from json.decoder import JSONDecodeError (I think its valid in python3 ? But why not working for me ?) 

但这是行不通的。仅以下情况有效:

from simplejson import JSONDecodeError

我是怎么做的?

virtualenv venv --no-site-packages -p python3 
pip install ipython
ipython
from json.decoder import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError'

在此处输入图片说明

ŁukaszRogalski

根据3.4.x docs的说明ValueError当JSON解码失败时将引发plain

JSONDecodeError3.5.x开始提供该类

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

yfinance json.decoder.JSONDecodeError

Python YFinance json.decoder.JSONDecodeError

JDownloader API json.decoder.JSONDecodeError

Python json.loads 错误 json.decoder.JSONDecodeError:

写入json时python json.decoder.JSONDecodeError

(Django, Python) 如何修复 json.decoder.JSONDecodeError?

如何修复此错误json.decoder.JSONDecodeError:Python

遍历json对象时json.decoder.JSONDecodeError

json读取错误json.decoder.JSONDecodeError:无效\ escape

创建/加载 json 文件 (json.decoder.JSONDecodeError: Extra data:)

yfinance 不工作 - 接收 json.decoder.JSONDecodeError

无法将passlib导入python3

Python3无法导入gi

使用Python和Flask制作应用时,出现json.decoder.JSONDecodeError

(Python 速成课程 16.8): json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

json.decoder.JSONDecodeError:额外数据:第1行第5列(字符4)并引发JSONDecodeError(“ Extra data”,s,end)

当 json.load(f) 时 json.dump 导致 json.decoder.JSONDecodeError

请求抛出json.decoder.JSONDecodeError:预期值:第1行第1列(字符0)

json.decoder.JSONDecodeError:预期值:第2行第1列(字符1)错误

json.decoder.JSONDecodeError:预期值:第1行第1列(字符0)

json.decoder.JSONDecodeError:期望值:第 1 行第 1 列(字符 0)Scrapy

json.decoder.JSONDecodeError:意外的 UTF-8 BOM(使用 utf-8-sig 解码)

遇到:json.decoder.JSONDecodeError:预期值:第1行第1列(字符0)

json.decoder.JSONDecodeError:虽然解析来自 API 的数据包含日语字符

获取 json.decoder.JSONDecodeError: Expecting value: line 1 column 1

错误:json.decoder.JSONDecodeError:期望值:第1行第1列(字符0)

json.decoder.JSONDecodeError:预期值:请求中的第1行第1列(字符0)

json.decoder.JSONDecodeError: Extra data: line 1 column 12 (char 11)

无法加载我刚刚创建的 JSON 文件(json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0))