ese-msc/introduction-to-python

ModuleNotFoundError: No module named 'lecture'

Closed this issue · 7 comments

Hi,
I have just set up Jupyter on my local and while running the following piece of import statements, I am getting an error: ModuleNotFoundError: No module named 'lecture'. There is no error while running -> import pybryt.

Surprisingly, If I run the same import statement(from lecture import pybryt_reference) on the online Jupyter link mentioned in the readme of Github, I am getting the same error.
Any suggestions to resolve it would be helpful. Thanks!

image

HI @edsml-10f37f99, thank you for raising this issue. Have you maybe moved the notebook (.ipynb) file or lecture.py? Please note that lecture.py must be in the same directory as the notebook you are running.

I rechecked that I haven't moved any files. I directly opened the Jupyter link in my browser as well and an error came up just after importing the statement. I tried recloning the repo as well on my local machine and found the same error.

When I checked inside my bin folder, I didn't find the lecture module either.

image

Thank you for the clarification. Could you please let me know what files you have in the directory where the notebook file is?

Thank you for your reply. Here is the list attached
image

Could you try adding the following two lines before the import statement?

import sys
sys.path.append("./")

I think I found the error, if I try running the import statements outside lecture1 dir, this error comes up.

I tried running the import statements by creating a new notebook inside lecture1 dir and it worked.
Thank you for your assistance !

image

image

Exactly, as we said earlier, lecture.py must be in the same directory as the notebook you are running. I am closing this issue now.