How can I change drives using python os?

I’m trying to change the current directory from C: to Y:
I tried:

import os

but I keep getting an error saying that it can’t locate the drive.
Essentially I’m looking for the equivalent of the

cd /d

command in cmd.

Best answer

Are you sure Y: really is a valid drive letter?

Try os.chdir('C:') and make sure that works. (It works for me.)