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

More than 40,000 techies are part of our ARKIT community. Join us today and keep learning Linux, Cloud, Storage, DevOps, and IT technologies.

Get Email Updates Download E-Books Facebook Page YouTube Channel Twitter Join Telegram Group Join WhatsApp Group
author avatar
Ravi Kumar Ankam
My name is Ravi Ankam. I am passionate about learning new technologies quickly and sharing knowledge with others. My goal is to help learners grow their skills, because the more you learn, the more you earn. See About Me

Ravi Kumar Ankam

My name is Ravi Ankam. I am passionate about learning new technologies quickly and sharing knowledge with others. My goal is to help learners grow their skills, because the more you learn, the more you earn. See About Me

Leave a Reply

Your email address will not be published. Required fields are marked *