PyHammer icon indicating copy to clipboard operation
PyHammer copied to clipboard

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

Open AlexSokokoliuk opened this issue 5 years ago • 9 comments

What should I do with that?

Traceback (most recent call last):
  File "pyhammer.py", line 864, in goToMain
    main(self.options)
  File "pyhammer.py", line 68, in main
    for i, line in enumerate(infile_init):
  File "C:\Users\alexs\Anaconda3\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9a in position 6209: invalid start byte

AlexSokokoliuk avatar Dec 21 '20 20:12 AlexSokokoliuk

That looks like the input file you tried to load could not be read. Was your file corrupted in some way? Are you sure that it is a plain text file? pyhammer.py is reading the file and decoding it with a standard utf-8 decoder, but finding a byte that is not specified in utf-8.

If possible, can you post the input file you were using and describe the specific steps you followed to generate this exception? Either by describing your GUI interactions/inputs if you used the GUI or else your specific commands if you used the command line.

zephyr5050 avatar Dec 21 '20 21:12 zephyr5050

Screenshot (256)

UBUNTU Python 3.9

sai-33 avatar Jun 05 '21 14:06 sai-33

Neither python pyhammer.py run nor python pyhammer.py install are valid commands to be used when running PyHammer. Use either python pyhammer.py -h or view the Starting PyHammer for information on valid inputs when running PyHammer.

Admittedly, this error case should be caught and handled rather than having it error as it does.

zephyr5050 avatar Jun 06 '21 02:06 zephyr5050

See #43 for another instance of this error being logged.

zephyr5050 avatar Jun 06 '21 02:06 zephyr5050

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

How to solve this issue

sai-33 avatar Jun 06 '21 05:06 sai-33

See my previous comment. If you still experience this issue after following the instructions therein, you can post additional information that would help address this issue.

zephyr5050 avatar Jun 06 '21 19:06 zephyr5050

Yes, I am experiencing the same issue. Screenshot (258)

sai-33 avatar Jun 07 '21 14:06 sai-33

It looks like you pulled up the GUI in your last attempt. Can you provide information everything you entered in each GUI as well as attach any input files you may have used which resulted in this error? Without seeing exactly how you're using this and what inputs you're providing, it will not be possible to troubleshoot.

This error looks to be an issue with the input file you've provided. Is this input file a standard text file?

zephyr5050 avatar Jun 07 '21 15:06 zephyr5050

I also encountered the same issue. The data files I used are the fits and txt files provided in your test_case.

(pythonhammer) liujunhuideMacBook:PyHammer-2.0.0 liujunhui$ python pyhammer.py -g qt.qpa.fonts: Populating font family aliases took 1018 ms. Replace uses of missing font family "Courier" with one that exists to avoid this cost. Traceback (most recent call last): File "/Users/liujunhui/PycharmProjects/PyHammer-2.0.0/pyhammer.py", line 864, in goToMain main(self.options) File "/Users/liujunhui/PycharmProjects/PyHammer-2.0.0/pyhammer.py", line 68, in main for i, line in enumerate(infile_init): File "/opt/miniconda3/envs/pythonhammer/lib/python3.9/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 6209: invalid start byte Abort trap: 6

JunHuiLiu2017 avatar Dec 21 '24 05:12 JunHuiLiu2017