jb2170 / better-adb-sync

Completely rewritten adbsync with --exclude
Apache License 2.0
363 stars 23 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 56: invalid start byte #37

Open W-quan opened 1 year ago

W-quan commented 1 year ago
Traceback (most recent call last):
  File "/usr/local/bin/adbsync", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/BetterADBSync/__init__.py", line 379, in main
    files_tree_destination = fs_destination.get_files_tree(path_destination, follow_links = args.copy_links)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/BetterADBSync/FileSystems/Base.py", line 45, in get_files_tree
    return self._get_files_tree(tree_path, statObject, follow_links = follow_links)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/BetterADBSync/FileSystems/Base.py", line 33, in _get_files_tree
    tree[filename] = self._get_files_tree(
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/BetterADBSync/FileSystems/Base.py", line 30, in _get_files_tree
    for filename, stat_object_child, in self.lstat_in_dir(tree_path):
  File "/usr/local/lib/python3.11/site-packages/BetterADBSync/FileSystems/Android.py", line 176, in lstat_in_dir
    for line in self.adb_shell(["ls", "-la", path]):
  File "/usr/local/lib/python3.11/site-packages/BetterADBSync/FileSystems/Android.py", line 87, in adb_shell
    adb_line = adb_line.decode(self.adb_encoding).rstrip("\r\n")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 56: invalid start byte

After adbsync push failed. rerun adbsync push get this error.

spectrMeltdown commented 1 year ago

I'm also getting this error

Vadworks commented 7 months ago

This might be to do with python version, I had this error, and after upgrading python and pip it went away

antonbo commented 6 months ago

Still happens with Python 3.12.2. Using on MacOS via pipx

  File "/Users/x/.local/pipx/venvs/betteradbsync/lib/python3.12/site-packages/BetterADBSync/FileSystems/Android.py", line 176, in lstat_in_dir
    for line in self.adb_shell(["ls", "-la", path]):
  File "/Users/x/.local/pipx/venvs/betteradbsync/lib/python3.12/site-packages/BetterADBSync/FileSystems/Android.py", line 87, in adb_shell
    adb_line = adb_line.decode(self.adb_encoding).rstrip("\r\n")

I have non-English names on my device

os97673 commented 3 weeks ago

This looks like a duplicate of #44 which has a test input to work with