0

I'm working with Jupyter Lab on a Mac. I've been trying to change the working directory in a .ipynb script via os.chdir(), so I can use the code to iteratively process multiple files in the working directory.

Eventually, I would like to use os.listdir() to iterate through the files in the directory.

My laptop files show up properly in the menu on the left, but for some reason, the following code won't work:

# set working directory
os.chdir('C:/Users/glonati/Documents/2019-_UNB SJ/drone/programs_code/python')
path = os.getcwd()

It produces the error: FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/glonati/Documents/2019-_UNB SJ/drone/programs_code/python'

I've quadruple checked the path names and tried all combinations of '', "", as well as , \, and /.

I read that I should try modifying the jupyter config file. But when I download the file (via jupyter notebook --generate-config), the only lines in the file are:

c.NotebookApp.allow_credentials = False
c.NotebookApp.port = 8889
c.NotebookApp.password_required = True

There is no line for c.NotebookApp.notebook_dir = ''.

Unsure why I'm having so much trouble with this. Any insight would be greatly appreciated! Thanks ahead of time!

Gina
  • 13
  • 2

0 Answers0