Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
__getitem__ Error
#1
Hi,

I have this code below:

import configparser
import graph

def main():
    # print('Python Graph Tutorial\n')

    # Load settings
    config = configparser.ConfigParser()
    config.read(['config.cfg', 'config.dev.cfg'])
    azureSettings = config['azure']

main()
And I'm getting this error:

Error:
Traceback (most recent call last): File "C:\Hosea\pythonProjects_Test\main.py", line 16, in <module> main() File "C:\Hosea\pythonProjects_Test\main.py", line 14, in main azureSettings = config['azure'] File "C:\Users\S951378\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 960, in __getitem__ raise KeyError(key) KeyError: 'azure'
Please help.
Reply


Messages In This Thread
__getitem__ Error - by stahorse - Jun-15-2022, 07:33 AM
RE: __getitem__ Error - by buran - Jun-15-2022, 07:37 AM
RE: __getitem__ Error - by stahorse - Jun-15-2022, 08:07 AM
RE: __getitem__ Error - by buran - Jun-15-2022, 08:21 AM
RE: __getitem__ Error - by stahorse - Jun-15-2022, 08:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  __getitem__ is readonly problem harun2525 4 5,936 May-10-2017, 05:44 PM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020