Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UnicodeDecodeError . . .
#1
Question 
When making a request for a file in .png format through the browser url I receive the following message ( UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte ), below follows the complete output of the error:

Running Kosmos Application
Browser Access - http://127.0.0.1:8000
Crl+c for flow command or Crl+z for stop
127.0.0.1 - - [27/Feb/2021 10:58:19] "GET / HTTP/1.1" 200 11522
127.0.0.1 - - [27/Feb/2021 10:58:19] "GET /website/assets/css/materialize.ext.css HTTP/1.1" 200 9116
127.0.0.1 - - [27/Feb/2021 10:58:19] "GET /website/assets/js/jquery.ext.js HTTP/1.1" 200 37
127.0.0.1 - - [27/Feb/2021 10:58:19] "GET /website/assets/fgs/wsi.svg HTTP/1.1" 200 286214
127.0.0.1 - - [27/Feb/2021 10:58:19] "GET /website/assets/fgs/cc-webstrucs.svg HTTP/1.1" 200 11882
127.0.0.1 - - [27/Feb/2021 10:58:19] "GET /website/assets/fgs/w3c-consortium.svg HTTP/1.1" 200 3587
127.0.0.1 - - [27/Feb/2021 10:58:19] "GET /website/assets/fgs/w3c-semantic.svg HTTP/1.1" 200 14439
127.0.0.1 - - [27/Feb/2021 10:58:19] "GET /website/assets/fgs/html5-semantic.svg HTTP/1.1" 200 2289
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /account/spark/add HTTP/1.1" 200 12442
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /account/assets/css/materialize.ext.css HTTP/1.1" 200 13389
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /account/assets/fgs/wsi.svg HTTP/1.1" 200 286214
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /website/assets/js/jquery.ext.js HTTP/1.1" 200 37
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /account/assets/fgs/cc-webstrucs.svg HTTP/1.1" 200 11882
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /account/assets/fgs/w3c-consortium.svg HTTP/1.1" 200 3587
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /account/assets/fgs/w3c-semantic.svg HTTP/1.1" 200 14439
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /account/assets/fgs/html5-semantic.svg HTTP/1.1" 200 2289
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "runwsgi.py", line 43, in application
    return [str(o_get.spark(start_response, v_uri)).encode("utf-8")]
  File "/home/joao/PycharmProjects/kosmos/cern/gear/requestget.py", line 61, in spark
    return o_get.m_get(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/safe/detectthreatstart.py", line 38, in m_get
    return o_get.m_get(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/safe/detectxssthreat.py", line 59, in m_get
    return o_get.m_get(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/safe/detectsqlithreat.py", line 49, in m_get
    return o_get.spark(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/flow/get/requesttypesget.py", line 61, in spark
    return o_get.spark(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/flow/get/requestclientfiles.py", line 702, in spark
    s_file = o_file.read()
  File "/usr/local/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
127.0.0.1 - - [27/Feb/2021 10:58:22] "GET /account/assets/fgs/cloud.png HTTP/1.1" 500 59
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "runwsgi.py", line 43, in application
    return [str(o_get.spark(start_response, v_uri)).encode("utf-8")]
  File "/home/joao/PycharmProjects/kosmos/cern/gear/requestget.py", line 61, in spark
    return o_get.m_get(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/safe/detectthreatstart.py", line 38, in m_get
    return o_get.m_get(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/safe/detectxssthreat.py", line 59, in m_get
    return o_get.m_get(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/safe/detectsqlithreat.py", line 49, in m_get
    return o_get.spark(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/flow/get/requesttypesget.py", line 61, in spark
    return o_get.spark(start_response, v_uri)
  File "/home/joao/PycharmProjects/kosmos/cern/flow/get/requestclientfiles.py", line 702, in spark
    s_file = o_file.read()
  File "/usr/local/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
127.0.0.1 - - [27/Feb/2021 10:58:29] "GET /account/assets/fgs/cloud.png HTTP/1.1" 500 59
What is this error about and how can I resolve it ?
Reply


Messages In This Thread
UnicodeDecodeError . . . - by JohnnyCoffee - Feb-27-2021, 03:27 PM
RE: UnicodeDecodeError . . . - by Serafim - Feb-27-2021, 04:41 PM
RE: UnicodeDecodeError . . . - by JohnnyCoffee - Feb-27-2021, 05:35 PM
RE: UnicodeDecodeError . . . - by Serafim - Feb-27-2021, 07:31 PM
RE: UnicodeDecodeError . . . - by JohnnyCoffee - Feb-27-2021, 08:47 PM
RE: UnicodeDecodeError . . . - by JohnnyCoffee - Feb-28-2021, 02:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd2 in position 16: invalid cont Melcu54 3 5,587 Mar-26-2023, 12:12 PM
Last Post: Gribouillis
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 34: character Melcu54 7 20,509 Sep-26-2022, 10:09 AM
Last Post: Melcu54
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 error from Mysql call AkaAndrew123 1 3,599 Apr-28-2021, 08:16 AM
Last Post: AkaAndrew123
  open(file, 'rb') raises UnicodeDecodeError binnybit 1 2,593 Sep-28-2020, 06:55 AM
Last Post: Gribouillis
  UnicodeDecodeError: pratheep 0 1,923 May-06-2020, 05:46 AM
Last Post: pratheep
  unicodedecodeerror:utf codec can't decode byte 0xe3 in position 1 mariolopes 3 2,946 Oct-14-2019, 10:17 PM
Last Post: mariolopes

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020