pavanagrawal123 / VSNotebooks

Jupyter Notebooks in Visual Studio Code
MIT License
63 stars 2 forks source link

cannot handle imports of file/module of the same project #27

Open tribbloid opened 5 years ago

tribbloid commented 5 years ago

considering 2 python files under the same directory:

file1.py:

def fn():
    print("called")

file2.py:

# %%
import file1

file1.fn()

file2.py can be successfully executed by python interpreter, but if you execute the cell using VSNotebook you'll get an error:

ModuleNotFoundError: No module named 'file1'

This bug may be caused by the fact that the temporary jupyter notebook file is created under a temporary directory (unlike the one used by real jupyter which is permanent), and cannot find other python files in workspace.

pavanagrawal123 commented 5 years ago

can you run this after importing os to check what is your working directory? os.getcwd()