Python SMB Connection
I have a Problem and i don't find my solution...
Here's my test Code:
import smb from smb.SMBConnection import SMBConnection from nmb.NetBIOS import NetBIOS netbios = NetBIOS() share_name = "share" user_name = "user" password = "passwd" server_IP = "xxx.xxx.xxx.251" local_machine_name = socket.gethostname() server_machine_name = netbios.queryIPForName(server_IP) print(server_machine_name) # create and establish connection conn = SMBConnection(user_name, password, local_machine_name, server_machine_name, domain="WORKGROUP", use_ntlm_v2=True) # 139 # 445 print(conn.connect(server_IP, 445))
i get every Time this Message:
but the Function
conn.connectreturn on Success True... not False....
i Have no idea what i'm doing wrong...
im trying to connect to my Synology NAS 718
i hope you guys know what im doing wrong....
There is also FTPS is that better for security?
how can i use this with Ports ?
from ftplib import FTP_TLS
ftp = FTP_TLS()
ftp.ssl_version = ssl.PROTOCOL_SSLv23
ftp.ssl_version = ssl.PROTOCOL_TLSv1_2
ftp.debugging = 2
but which version TLS or SSL ?
Never used. If needed, I use SFTP
@DavinE yes sir, but it may begin at first folder where you are authorized. try first without folder, only a file name to check after upload where it has been stored
@cvp really thanks a lot for your help!! and for your Time to help me out ;) Thanks!!
i played now a while and it works like i will create folders upload files etc. great!!
beautiful evening @cvp xD
I Have a Problem...
I used this code:
self.subDirCustomer_Prüfungen = 'Prüfungen' self.cur.encoding = 'utf-8' self.cur.mkd(self.subDirCustomer_Prüfungen)
But i get this Output folder
How can i tell
mkdto use the utf-8....
Do you know That ?
@DavinE sincerely, I don't know. I got the same kind of problems with accents like é, è, à on some, not all, machines I connect in smb. To avoid this, I don't use anymore accents in my folder/file names
Edit : even 10 years ago, this kind problem did already exist, see here
@cvp aahhhh ;)
Okay shit but thanks for your answer
When i find something i tell you
Wild guess but...
self.subDirCustomer_Prüfungen = 'Prüfungen'.encode('utf-8')
Now i get
b'Pr\xc3\xbcfungen'as folder Name
How can i tell mkd to use the utf-8....
Sorry, my answer guess that you still speak about smb. I just see now that your post uses mkd, thus ftp, sorry.
I remember an old post here where the problem has been solved with
ftp.encoding = "utf-8"
Then, I can't help more.
I find my Solution.
I removed the encoding = ‚utf-8‘ and it works