简体   繁体   中英

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. 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'

Treating "" as empty values was a bug in configparser pre 3.2 (it made it impossible to store "" as a value).

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

From :

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

To :

except:
    pass

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