I've just updated to Python 3.11 from 3.9 by reinstalling Anaconda and this super-basic piece of code now doesn't work in Jupyter-lab.
import os
folder = r'Z:\Chris_ResearchDrive\20220520_horopito'
os.chdir(folder)
Throws:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[7], line 4
1 import os
3 folder = r'Z:\Chris_ResearchDrive\20220520_horopito'
----> 4 os.chdir(folder)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'Z:\\Chris_ResearchDrive\\20220520_horopito'
Addition 20230926 @ 20:10 I've tried all possible permutations of single and double forward and backward slashes and with removing the 'r' at the beggining for a raw string. This still doesn't work, which tells me something as this should absolutely work.
Addition 20230926 @ 20:37 This seems to be a specific issue with the network drive location I'm trying to access. Local drives open without a problem. So, this works:
folder = r'E:\local_folder'
This doesn't:
folder = r'Z:\network_folder'
Again, this is new behaviour with my Anaconda reinstall and Python 3.11. I have had no problem pasting network drive paths into Python 3.9 and accessing them using os.chdir for years.
Apologies for the confusion over the debugging output in my original post. I tried to simplify the folder path but forgot to make the same change to the debugging output. I've now provided averything exactly as-is.
I think insted of this :
You should try this :