B
B
BlackHole2015-04-28 22:23:33
Python
BlackHole, 2015-04-28 22:23:33

How to get the correct ftp-server content when getting bugs?

There is a raised ftp-server using Golden FTP Server PRO (I have been using it for a long time), but there was a need to constantly transfer files to another PC. The idea arose to write a program in Python 3.4.1 that checks the contents of the folder on your PC and the contents of the ftp-server and, if there are inconsistencies, uploads it to the PC. However, there was a problem with displaying the contents of the ftp-server, the names written in Cyrillic are displayed in shorthand (tried "s.encode().decode()" using different encodings did not help, maybe the combination of encodings was not correct?). The ftplib Python module was used to work with ftp-server. This procedure was performed on the same PC/server. Screenshots of code and results below. Tell me how to get out of this situation.
Code
b8a53b4bf6ed4f3f8202aae010aa77f2.jpg
Result
da55a5692edd4f218b9276f0df992c65.jpg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis, 2015-04-28
@BlackHole

The first google link gives the following:
ftp = ftplib.FTP(...)
ftp.__class__.encoding = sys.getfilesystemencoding()

R
Roman Kitaev, 2015-04-28
@deliro

Try this
or
UhhvazL.png

K
KULINAR847, 2018-09-20
@KULINAR847

There was also such a task, although ftp is different, but this solution helped:
Tested on windows 7.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question