ChatGPT Prompt Engineering for Developers Code

I was coding along with the lecture on “Guideline for Prompting”:

But encountered some issue with “dotenv”.

When I copied the code snippet this in my own Jupyter notebook cell:

import openai
import os

from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())

It shows “ModuleNotFoundError: No module named ‘dotenv’”

Then I tried “python -m pip install python-dotenv” and “npm install dotenv” on the cell above, it still shows the same error. Then I tried to type both installing command in the terminal, it was successfully installed, and when I closed and opened the jupyter notebook, it still shows the same error.

Is there anyone who is more experienced can help me with this? I want to be able to use the code snippet to code my own project later, so I really appreciate if someone can point out where I did wrong…


Hi @Carolina_Li,

You can take a look at this YouTube video to understand .env.

I’d like to point out a few things here:

  • .env are environment files which help you store information, which you can read through your code.
  • In the course, the file includes information regarding the OpenAI API. This file is neither visible, not available to the learners. You can check out the video to know how to create your own and how to use it.
  • The API key inside the file is only for the purposes of the platform, so you cannot replicate it on your local machine or colab.
  • In order to run things on your local or colab, you need to create your own API key from the OpenAI platform.

Hope this helps,