Skip to main content
Question

ImportError: cannot import name 'JSONDecodeError' from 'requests.exceptions'

  • October 19, 2023
  • 1 reply
  • 3623 views

himanshu1234567
Discovered Fame

while running python program using streamsets python sdk we are getting error 

File "/var/lib/jenkins/.local/lib/python3.8/site-packages/streamsets/sdk/exceptions.py", line 5, in <module> from requests.exceptions import HTTPError, JSONDecodeError ImportError: cannot import name 'JSONDecodeError' from 'requests.exceptions'

we have found solution for this but we want to know why we are getting this error.
Solution for this is manually we are replacing line “from requests.exceptions import HTTPError, JSONDecodeError”   with 
“from json import JSONDecodeError”

1 reply

Forum|alt.badge.img
  • StreamSets Employee
  • 20 replies
  • October 23, 2023

I have seen this problem when ‘requests’ is outdated. It looks like JSONDecodeError was added in requests 2.27.0. Update your requests package to see the proper error message.


Reply