Eclipse + PyDev 说 json.load() 和 json.dump() 不存在

标签 eclipse python-3.x pydev

使用 Python 3.4 的 Eclipse + PyDev 中的以下几行可以正常工作,但它突出显示为 导入时 undefined variable :转储 错误:

import json
with open('C:\\test', 'w') as outfile:
    json.dump([1, 2, 3], outfile)

这是 Eclipse 编辑器的快照:

Error on json.dump

如何消除该错误?

编辑

输出:

import json
with open('C:\\test', 'w') as outfile:
    json.dump([1, 2, 3], outfile)

print(json.__file__)

是:

C:\Python34\lib\json\__init__.py

以下是 Eclipse 显示的属性列表:

List of attributes of json according to Eclipse

最佳答案

文件 ../lib/json/__init__.py 第 313 行出现问题

...
if s.startswith(u'\ufeff'):
...

将此行更改为

if s.startswith('\ufeff'):

或者等待新版本

关于Eclipse + PyDev 说 json.load() 和 json.dump() 不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23634115/

相关文章:

java - 如何在mongo中插入带有日期的文档?

python-3.x - 使用 Podio API 时出错 - 文件上传操作

python - 无法导入包 - "ImportError: No module named _mechanize"

python - 如何替换Python中的函数?

python - eclipse : "Python not configured"

java - Eclipse 中特殊属性的编码

Ubuntu 上的 Eclipse 在使用文件系统工作目录设置运行配置时出现 "Update LCD"错误

eclipse - 在 PyDev 中启动和调试单个脚本

java - 使用动态编译和加载的代码了解 Eclipse 调试源查找

python - Eclipse + PyDev 导入错误