DonJayamanne / vscodeJupyter

Jupyter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter
MIT License
335 stars 34 forks source link

VSCode - Jupyter extension - Automatically set working directory when opening a new notebook #79

Open DonJayamanne opened 7 years ago

DonJayamanne commented 7 years ago

From @tamlhp on May 12, 2017 20:51

Environment data

VS Code version: 1.12.1 Python Extension version: Jupyter 1.1.3 Python Version: Python 3.6.0 |Anaconda custom (64-bit)| OS and version: Ubuntu 14.04 LTS

Actual behavior:

ImportError: cannot import name 'ABC'

Expected behavior

Can import class from local module

Steps to reproduce:

Normally when I open the jupyter notebook in web browser, I can still do the import. It understands where the notebook is located. Maybe the plugin in VSCode should automatilly understand where the current file is located. That is, when click on "Run here", it asks "Open a new notebook", and that when it should automatically change the startupFolder.

Quote from gandhis1: The problem is that the jupyter startup folder is the workspace root. If your project is located in a sub-directory of your workspace root, then it will not work. You either need to change your workspace root, or change the setting below:fi "jupyter.notebook.startupFolder": "${workspaceRoot}",

--> I think this solution is not flexible to different py files opened in VS code in the same time. That is, we want to "jupyter" with some file and then "jupyter" with another file.

Copied from original issue: DonJayamanne/pythonVSCode#957