Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71545 > unrolled thread
| Started by | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| First post | 2014-05-14 13:23 +0200 |
| Last post | 2014-05-14 13:23 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-05-14 13:23 +0200
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2014-05-14 13:23 +0200 |
| Subject | python3; ftplib: TypeError: Can't convert 'bytes' object to str implicitly |
| Message-ID | <mailman.10000.1400066651.18130.python-list@python.org> |
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?
--
Antoon Pardon
Back to top | Article view | comp.lang.python
csiph-web