简体   繁体   English

Configparser.py KeyError(Python / Flask)

[英]Configparser.py KeyError (Python/Flask)

I am working on an app and I am getting this configparser.py error on my pythonanywhere deployment, however the app runs fine locally. 我正在开发一个应用程序,并且在pythonanywhere部署中遇到此configparser.py错误,但是该应用程序在本地运行良好。 I am not sure why this error is coming up. 我不确定为什么会出现此错误。

Traceback (most recent call last): 追溯(最近一次通话):
File "/usr/lib/python3.7/configparser.py", line 845, in items d.update(self._sections[section]) KeyError: 'cassBot' 文件d.update(self._sections [section])KeyError:'cassBot'中的文件“ /usr/lib/python3.7/configparser.py”,行845

Treating "" as empty values was a bug in configparser pre 3.2 (it made it impossible to store "" as a value). 将“”视为空值是configparser 3.2之前的版本中的一个错误(这使得无法将“”存储为值)。

In your case I advise u to changed bypass the bug like this: 在您的情况下,我建议您更改绕过这样的错误:

  • open /usr/lib/python3.7/configparser.py and edit lines 846,847,848 打开/usr/lib/python3.7/configparser.py并编辑846,847,848行

From : 来自:

except KeyError:
    if section != self.default_section:
        raise NoSectionError(section)

To : 至 :

except:
    pass

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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