Python Forum
'utf-8' codec can't decode byte 0xe2 in position 122031: invalid continuation byte
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'utf-8' codec can't decode byte 0xe2 in position 122031: invalid continuation byte
#11
(Sep-18-2020, 03:24 PM)tienttt Wrote: This is my previous code. I realized the json I got from Jira Rest API is correct but json.dumps() makes it incorrect.
It's the plain text of the HTTP message body you get back now,which is not json.
Also strange that you do call in a subprocess.
The API Doc usually have expiation of login with OAuth and getting the json response back,all this can of course be done in Requests alone.
Reply
#12
Hi Snippsat,

Jira provide a sample code in Java to call their REST API and I leverage their OAuthTutorialClient-1.0.jar. That's why I use subprocess to run a command in cmd. The result of command line is a string in json-format. I use json.loads() to load that string to the variable "issue" before pass it to json.dumps() and append it to the AllIssue.json file.

Regards,
Tien
Reply
#13
I rewrite the function and use Requests lib to call Jira Rest API directly, then use json.dump(). The issue is resolved. Thanks all.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  calculate data using 1 byte checksum korenron 2 287 Nov-23-2021, 07:17 AM
Last Post: korenron
  How to do line continuation in Jupyter Notebook? Mark17 4 519 Sep-22-2021, 04:22 PM
Last Post: ibreeden
  ASCII-Codec in Python3 [SOLVED] AlphaInc 4 782 Jul-07-2021, 07:05 PM
Last Post: AlphaInc
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 error from Mysql call AkaAndrew123 1 1,126 Apr-28-2021, 08:16 AM
Last Post: AkaAndrew123
  How to understand the byte notation in python3 blackknite 3 840 Feb-23-2021, 04:45 PM
Last Post: bowlofred
  codec for byte transparency Skaperen 7 1,690 Sep-25-2020, 02:20 AM
Last Post: Skaperen
  how to encode and decode same value absolut 2 960 Sep-08-2020, 09:46 AM
Last Post: TomToad
  How do I write a single 8-bit byte to a file? MysticLord 2 1,190 Sep-03-2020, 12:27 PM
Last Post: MysticLord
  convert array of numbers to byte array adetheheat 3 1,083 Aug-13-2020, 05:09 PM
Last Post: bowlofred
  'charmap' codec louis216 4 5,219 Jun-30-2020, 06:25 AM
Last Post: louis216

Forum Jump:

User Panel Messages

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