Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

Problems with encoding: UnicodeDecodeError: 'utf-8' codec can't decode byte: invalid start byte #41

@krantic

Description

@krantic

Hello,
when starting adb-sync I always get the following error message. I'm using Windows 10 1909, Python 3.8.1 and the latest version of the script.

python adb-sync --reverse /sdcard/test/ "C:\Backup\2019-12-29\sdcard"
INFO:root:Sync: local b'C:\\Backup\\2019-12-29\\sdcard', remote b'/sdcard/test/'
Traceback (most recent call last):
  File "adb-sync", line 883, in <module>
    main()
  File "adb-sync", line 870, in main
    if not syncer.IsWorking():
  File "adb-sync", line 507, in IsWorking
    return self.adb.IsWorking()
  File "adb-sync", line 219, in IsWorking
    with Stdout(self.adb +
  File "adb-sync", line 76, in __init__
    self.popen = subprocess.Popen(args, stdout=subprocess.PIPE)
  File "C:\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python38\lib\subprocess.py", line 1247, in _execute_child
    args = list2cmdline(args)
  File "C:\Python38\lib\subprocess.py", line 549, in list2cmdline
    for arg in map(os.fsdecode, seq):
  File "C:\Python38\lib\os.py", line 818, in fsdecode
    return filename.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 41: invalid start byte

As a workarround I tried different encodings for the script but without success:

  1. UTF-8/UTF-8 with BOM/Windows 1252/ISO 8859-1: Same error message as above.
  2. UTF-16 LE/BE:
SyntaxError: Non-UTF-8 code starting with '\xff' in file C:\Users\Kristian\adb-sync\adb-sync on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Are there any other solutions ?
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions