Python using os and chdir to read and write to iCloud

Question:

I am using the following python code to access a folder in iCloud. I am getting an error of:

FileNotFoundError: [Errno 2] No such file or directory:

import os
os.chdir('/Users/me/Library/Mobile Documents/com~apple~CloudDocs/jupyter/')

Is there something I am missing?

Asked By: jz_

||

Answers:

There is no backslash in the directory name; you aren’t using a shell, so the space does not need to be escaped.

os.chdir('/Users/me/Library/Mobile Documents/com~apple~CloudDocs/jupyter/')
Answered By: chepner
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.