mar10 / pyftpsync

Synchronize directories using FTP(S), SFTP, or file system access.
https://pyftpsync.readthedocs.io
MIT License
117 stars 25 forks source link

Special characters #17

Closed ghost closed 6 years ago

ghost commented 7 years ago

I'm trying to upload some files with this example code:

from ftpsync.targets import FsTarget
from ftpsync.ftp_target import FtpTarget
from ftpsync.synchronizers import UploadSynchronizer

local = FsTarget("~/temp")
user ="joe"
passwd = "secret"
remote = FtpTarget("/temp", "example.com", username=user, password=passwd)
opts = {"force": False, "delete_unmatched": True, "verbose": 3, "dry_run" : False}
s = UploadSynchronizer(local, remote, opts)
s.run()

I've getting an error: Traceback (most recent call last):.. File "upload.py", line 14, in s.run() File "C:\Python27\lib\site-packages\ftpsync\synchronizers.py", line 128, in run res = self._sync_dir() File "C:\Python27\lib\site-packages\ftpsync\synchronizers.py", line 471, in _sync_dir self._sync_dir() File "C:\Python27\lib\site-packages\ftpsync\synchronizers.py", line 456, in _sync_dir self.local.flush_meta() File "C:\Python27\lib\site-packages\ftpsync\targets.py", line 547, in flush_meta self.cur_dir_meta.flush() File "C:\Python27\lib\site-packages\ftpsync\targets.py", line 351, in flush s = json.dumps(self.dir, sort_keys=True) File "C:\Python27\lib\json__init__.py", line 251, in dumps sort_keys=sort_keys, **kw).encode(obj) File "C:\Python27\lib\json\encoder.py", line 209, in encode chunks = list(chunks) File "C:\Python27\lib\json\encoder.py", line 434, in _iterencode for chunk in _iterencode_dict(o, _current_indent_level): File "C:\Python27\lib\json\encoder.py", line 408, in _iterencode_dict for chunk in chunks: File "C:\Python27\lib\json\encoder.py", line 408, in _iterencode_dict for chunk in chunks: File "C:\Python27\lib\json\encoder.py", line 387, in _iterencode_dict yield _encoder(key) UnicodeDecodeError: 'utf8' codec can't decode byte 0xaf in position 14: invalid start byte

mar10 commented 7 years ago

Do you have file- or folder names with special characters? Maybe we can reduce the case to one distinct file. Or can you set a breakpoint?

mar10 commented 6 years ago

Closing for now. Maybe you can check with the latest version...