I have the following code:
import ftplib
import easygui
# log in
session = ftplib.FTP(host, username, password)
# upload thumbnail
print('Select your thumnbail')
thumbnail = easygui.fileopenbox('', 'Select your thumbnail')
thumbnailsplit = thumbnail.split('\\')
thumbnailname = thumbnailsplit[-1]
ftplib.FTP.cwd(dirname='/thumbnails')
file = open(thumbnail, 'rb')
session.storbinary(f'STOR {thumbnailname}', file)
# close session
file.close()
session.quit()
According to the docs this should change the directory to 'thumbnails' in my FTP server but I get this error instead:
Traceback (most recent call last):
File "MovieUpload.py", line 13, in <module>
ftplib.FTP.cwd(dirname='/thumbnails')
TypeError: cwd() missing 1 required positional argument: 'self'
The docs state to use it like this:
FTP.cwd(pathname)
What am I doing wrong?