[Python] why am i seeing TypeError: 'module' object is not subscriptable

Discussão em 'Python' iniciado por Stack, Junho 25, 2025.

  1. Stack

    Stack Membro Participativo

    i am using pycharm (python version 3.13.5) and i am trying to use youtube api to get publicly available data.

    in my config.py i have:

    config = { "google_api_keys": "abc", "yt_playlist_id": "xyz" }


    youtube_producer.py has:

    def main(): logging.info("START")
    google_api_key = CONFIG["google_api_key"]
    yt_playlist_id = CONFIG["yt_playlist_id"]
    get_playlistItems(google_api_key, yt_playlist_id)

    if name == "main": logging.basicConfig(level=logging.DEBUG)
    main()


    the error i keep getting is

    INFO:root:START
    Traceback (most recent call last):
    File "Project0\src\producer\yotube_producer.py", line 23, in <module>
    sys.exit(main())
    ~~~~^^
    File "Project0\src\producer\yotube_producer.py", line 17, in main
    google_api_key = CONFIG["google_api_key"]
    ~~~~~~^^^^^^^^^^^^^^^^^^
    TypeError: 'module' object is not subscriptable


    Please help me out here and explain why am i getting this and how to get rid of it?

    Continue reading...

Compartilhe esta Página