listdir on IP Adress - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: listdir on IP Adress (/thread-28419.html) |
listdir on IP Adress - OEMS1 - Jul-18-2020 Hallo Guys, I need to get content of a windows "networkshare". It is and will not be added as networkdrive with a letter. In Windows Explorer I can resolve the content via "\\192.168.5.1" --> dir1 --> dir2 With Python I am trying import os d=os.listdir('\\\\192.168.5.1') and differnt version of slashes --> In the best case I get: FileNotFoundError: [WinError 67] any help RE: listdir on IP Adress - Larz60+ - Jul-19-2020 that ip address links to several domains see: https://whois.domaintools.com/192.168.5.1 it seems to connect to none of them, thus your File Not Found error RE: listdir on IP Adress - DeaD_EyE - Jul-19-2020 @Larz60+ it's a private IP in his home network or somewhere else behind a router. The easy short solution is, to mount your samba share to a drive letter. Then you can use open() , os.listdir and other operations on file system.You can't use open or other file system operations like os.listdir on a samba share.You can access with a client the samba share: https://pypi.org/project/smbprotocol/ RE: listdir on IP Adress - bowlofred - Jul-19-2020 For whatever reason, although you can list the contents of the shares, you don't seem to be able to list the shares themselves. On my windows 10 machine: >>> len(os.listdir('//10.0.0.10')) # fails to list the shares by IP Traceback (most recent call last): File "<stdin>", line 1, in <module> FileNotFoundError: [WinError 67] The network name cannot be found: '//10.0.0.10' >>> len(os.listdir('//10.0.0.10/USB_Storage')) # listing contents of a share works fine 84 |