0

I am attempting to change a directory via its IP address or using it's unc (as I am working in windows). This is due to the external server being mapped to different drives for different users.

Using os.chdir(r'path\\to\remote\directory') does not seem to work and I wonder if there are any alternatives that python doesn't hate i.e. an IP address?

0

1 Answer 1

1

Works fine for me:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.chdir(r"\\myserver\myshare")
>>> os.getcwd()
'\\\\myserver\\myshare'

It's hard to tell if the r'path\\to\remote\directory' typo is also in your actual code and how you determined it "does not work".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.