简体   繁体   中英

Can't access share drive on windows machine from Python

I have a windows machine with a server name 'HPTOUCH'. I also have a share directory called 'Movies' on this windows machine. In raspian rasp pi using python 2.7, I am writing a simple test program to access the windows directory from the Pi. I've tried all the suggestions here, ie

    os.listdir(r'\\HPTOUCH\Movies')
    os.listdir('\\\\HPTOUCH\\Movies')
    os.listdir(r'\\192.168.1.103\Movies')
    os.listdir('////HPTOUCH//Movies')
    os.listdir(r'\\smb://HPTOUCH//Movies')

Well, you get the idea. I keep getting an error: No such file or directory. What am I doing wrong. If I am in XBMC, I can easily access any movie on that drive, so permissions seem to be OK. What is the python code for accessing a windows share?

Linux (under XBMC) doesn't support UNC style paths. You either have to mount the remote filesystem first, use an existing mount point or use https://pythonhosted.org/pysmb/ library.

To mount your remote server:

smbmount //192.168..103/Movies /mnt/movies –o "username=Tony,password=mypass"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM