python3;

A

Antoon Pardon

This is the code I run (python 3.3)

host = ...
user = ...
passwd = ...

from ftplib import FTP

ftp = FTP(host, user, passwd)
ftp.mkd(b'NewDir')
ftp.rmd(b'NewDir')

This is the traceback

Traceback (most recent call last):
File "ftp-problem", line 9, in <module>
ftp.mkd(b'NewDir')
File "/usr/lib/python3.3/ftplib.py", line 612, in mkd
resp = self.voidcmd('MKD ' + dirname)
TypeError: Can't convert 'bytes' object to str implicitly

The problem is that I do something like this in a backup program.
I don't know the locales that other people use. So I manipulate
all file and directory names as bytes.

Am I doing something wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top