Uploading files NAS drive from Raspberry PI using python

Thread Starter

zazas321

Joined Nov 29, 2015
669
Hello. I am trying to do a file transfer to the NAS drive that is connected to the local network. I am able to access it using an IP address. After I login to the NAS:
1599463100301.png


I am able to upload files there and etc.


Now I need to be able to upload files there using python script. I have tried the SMBConnection library but with no luck so far:

Code:
from smb.SMBConnection import SMBConnection

conn = SMBConnection('ID','password','Raspberry_pi','NAS_STORAGE')
conn.connect('192.168.56.232',5000,60)
The error I am getting:
Code:
Traceback (most recent call last):
  File "/home/pi/Desktop/lukas_programming/TEST.py", line 4, in <module>
    conn.connect('192.168.56.232',5000,60)
  File "/home/pi/.local/lib/python3.7/site-packages/smb/SMBConnection.py", line 111, in connect
    self.sock = socket.socket(sock_family)
  File "/usr/lib/python3.7/socket.py", line 151, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 97] Address family not supported by protocol
First of all. I do not have any clue what do I pass for 3rd and 4th arguments for SMBConnection.
Looking at the documentation:
1599465276880.png

I still cannot figure out what they mean about remote_name. Since I do not have direct access to the NAS drive, I do not know if I can figure out what is the remote name? I have been allocated 4GB of data and been provided user id, password and the IP address to access the drive.

Can someone suggest a more simple approach how to upload files to NAS drive using python ?
 
Last edited:
Top