Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Python, how can I access a shared folder on windows network?

I have a file that I would like to copy from a shared folder which is in a shared folder on a different system, but on the same network. How can I access the folder/file? The usual open() method does not seem to work?

like image 420
BrickByBrick Avatar asked Aug 24 '11 02:08

BrickByBrick


People also ask

How do I access a shared folder on a network?

Open My Computer and click on the Tools menu option. From the drop down list, choose Map Network Drive. Pick a drive letter that you want to use to access the shared folder and then type in the UNC path to the folder.

How do you access a network file in Python?

open(r'\\HOST\share\path\to\file') and open('\\\\HOST\\share\\path\\to\\file') worked with backward slash. For pd. read_csv() , forward or backward slash, doesn't matter.


Video Answer


1 Answers

Use forward slashes to specify the UNC Path:

open('//HOST/share/path/to/file') 

(if your Python client code is also running under Windows)

like image 154
Johnsyweb Avatar answered Sep 20 '22 15:09

Johnsyweb