Python中的“警告”部分已存在错误

时间:2018-10-19 01:22:20

标签: python python-3.x scopus

今天,我用Python编写了一个脚本,以从Scopus API中提取一些数据。该脚本运行良好。突然我的代码崩溃了,没有再次执行。导入Scopus模块时显示错误:

import scopus

这是我收到的错误:

    "D:/PhD/Projects/Code/scopus/main.py"
Traceback (most recent call last):
  File "D:/PhD/Projects/Code/scopus/main.py", line 1, in <module>
    import scopus
  File "C:\Users\myUser\AppData\Local\Continuum\anaconda3\lib\site-packages\scopus\__init__.py", line 7, in <module>
    from scopus.utils import *
  File "C:\Users\myUser\AppData\Local\Continuum\anaconda3\lib\site-packages\scopus\utils\__init__.py", line 1, in <module>
    from scopus.utils.create_config import *
  File "C:\Users\myUser\AppData\Local\Continuum\anaconda3\lib\site-packages\scopus\utils\create_config.py", line 5, in <module>
    from scopus.utils.startup import config, CONFIG_FILE
  File "C:\Users\myUser\AppData\Local\Continuum\anaconda3\lib\site-packages\scopus\utils\startup.py", line 23, in <module>
    config.add_section('Warnings')
  File "C:\Users\myUser\AppData\Local\Continuum\anaconda3\lib\configparser.py", line 1200, in add_section
    super().add_section(section)
  File "C:\Users\myUser\AppData\Local\Continuum\anaconda3\lib\configparser.py", line 659, in add_section
    raise DuplicateSectionError(section)
configparser.DuplicateSectionError: Section 'Warnings' already exists

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

我刚刚意识到如何解决该错误。我打开了错误中提到的文件:

C:\Users\myUser\AppData\Local\Continuum\anaconda3\lib\site-packages\scopus\utils\startup.py

然后,我评论了第23行,问题就解决了!