I frequently use a script to FTP files, but since upgrading to Python 3.9, Iíve been unable to run the script without getting an error stating that codec canít decode certain bytes because theyíre invalid start bytes. Hereís the most recent error:

Traceback (most recent call last):

  File "C:\Tools\source\GBAS_master\GBAS\src\RepositorySync.py", line 601, in <module>


  File "C:\Tools\source\GBAS_master\GBAS\src\RepositorySync.py", line 537, in ProcessSubdirectory

    unusedDirFlag1 = ProcessFileGroup('*.COM', trimmedTarget) # Must be first as this creates new output _ListFiles.txt

  File "C:\Tools\source\GBAS_master\GBAS\src\RepositorySync.py", line 506, in ProcessFileGroup


  File "C:\Tools\source\GBAS_master\GBAS\src\RepositorySync.py", line 370, in GetFile

    res = self.ftp.retrlines('RETR ' + file, SpecialWrite) # This line varies....

  File "C:\Program Files\Python39\lib\ftplib.py", line 458, in retrlines

    line = fp.readline(self.maxline + 1)

  File "C:\Program Files\Python39\lib\codecs.py", line 322, in decode

    (result, consumed) = self._buffer_decode(data, self.errors, final)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfa in position 6310: invalid start byte

0xfa is an interpunct/middle dot(∑). I also got the same error multiple times with byte 0xa9 which is the copyright symbol (©).
My team believes a Python bug is causing this error because my boss was able to run the exact same script minutes with Python 3.7.7 & 3.8.3 without throwing an error.

Please let me know if I can provide any more information.


In case this helps, it looks like someone else ran into this same error with Python 2.7 back in 2017: https://github.com/dxa4481/truffleHog/issues/27


Thank you,


Daniel Cummings

Software Developer

800-786-7930 Toll Free

208-424-0595 Fax



CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information or otherwise be protected by law. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.