Home > Net >  ImportError: API_KEY
ImportError: API_KEY

Time:07-16

enter image description here

Hi, I am getting an error while importing API_KEY, please advise.

CodePudding user response:

Sorry, I am writing this as an answer. I do not have rights to comment.

If you observe the path of config file in the error description, it's pointing to some library in site-packages. It's not your config.py file.

You need to give the correct path to your config file.

P.S: Using Python files like config.py is not the best way to store the configurations. I would recommend to use dotenv or some other configuration helper packages.

CodePudding user response:

From the code from config import API_KEY , you are trying to import API_KEY from a [Pypi package]"https://pypi.org/project/config/". If you want to use config.py for getting API_KEY try to use other config methods like ConfigParser

  • Related