ImportError: cannot import name UnrewindableBodyError | Arkit

I was getting an error while working with smart file API, error is “ImportError: cannot import name UnrewindableBodyError“. I have searched for a solution lot of blogs but nothing worked out for me. At a later point in time I tried the below steps to resolve my issue.

ImportError: cannot import name UnrewindableBodyError

Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/urllib3/connection.py", line 45, in <module>
from .util.ssl_ import (
File1 "/usr/lib/python2.7/site-packages/urllib3/util/__init__.py", line 4, in <module>
from .request import make_headers
File2 "/usr/lib/python2.7/site-packages/urllib3/util/request.py", line 5, in <module>
from ..exceptions import UnrewindableBodyError
ImportError: cannot import name UnrewindableBodyError

Followed below steps to resolve the error, Un-install cryptography old version and install new version

$ sudo pip uninstall cryptography
$ sudo pip install cryptography

Remove requests module from python and re-install it

$ sudo pip uninstall requests
$ sudo pip install requests

Install Requests RPM packages

# yum remove python-requests
# yum install python-requests

URI utilities also need to be re-installed with new version

$ sudo pip uninstall urllib3
$ sudo yum install python-urllib3

That’s it. It resolved the above issue and able to run API perfectly. Try it out best of luck.

>>> from smartfile import BasicClient
>>> api = BasicClient('ID', 'ScretKey')
>>> file = open('/root/anaconda-ks.cfg', 'rb')
>>> api.upload('/root/anaconda-ks.cfg', 'file')

Simple smart file API to upload data

Related Articles

File Base locking initialization failed

All Shell Scripts Arkit

Thanks for your wonderful Support and Encouragement