I am using a python script to upload a file to s3 bucket. However I was facing an error like
S3 Upload Failed with exception : An HTTP Client raised an unhandled exception: cannot switch to a different thread
when I investigated, I found strange behavior of packages
when I import
boto3 in my script it throws an exception. but same when I remove
import grequests from my code the file gets uploaded to s3 with no issues.
import sys, os, time import grequests import boto3, ntpath
I really need both
boto3 in my code. but I cannot import
grequests if I want to use boto3 for s3 .
Is there any way to prevent this behavior?
Looks like a known issue: https://github.com/spyoungtech/grequests/issues/123.
Solutions suggested in the Github thread include changing order of imports and using an alternative library like https://pypi.org/project/fgrequests/.