Search code examples
pythonimporterror

Python error ' ModuleNotFoundError:'


I am getting this error

Traceback (most recent call last):
File "Exporter.py", line 3, in <module>
import sys,getopt,got,datetime,codecs
File "C:\Users\Rohil\Desktop\GetOldTweets-python-master\got\__init__.py", line 1, in <module>
import models
ModuleNotFoundError: No module named 'models'

my directory tree is:

C:\Users\Rohil\Desktop\GetOldTweets-python-master\got

this contains 2 folders: manager and models and 1 __init__.py file with the code :

import models
import manager

i am executing a file with the path: C:\Users\Rohil\Desktop\GetOldTweets-python-master\Exporter.py

I can't figure out what the issue is. can anyone assist me?


Solution

  • Set the environment variable PYTHONPATH=C:\Users\Rohil\Desktop\GetOldTweets-python-master\got (how exactly, depends on your operating system)