RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1785666 - TypeError("unsupported operand type(s) for -=: 'Retry' and 'int'",)
Summary: TypeError("unsupported operand type(s) for -=: 'Retry' and 'int'",)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-requests
Version: 7.5
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Charalampos Stratakis
QA Contact: RHEL CS Apps Subsystem QE
URL:
Whiteboard:
Depends On:
Blocks: 1811055 1811056 1811057 1811058
TreeView+ depends on / blocked
 
Reported: 2019-12-20 15:55 UTC by Martin Bašti
Modified: 2023-12-15 17:07 UTC (History)
17 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 1811055 1811056 1811057 1811058 (view as bug list)
Environment:
Last Closed: 2020-09-29 19:39:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:3886 0 None None None 2020-09-29 19:40:31 UTC

Description Martin Bašti 2019-12-20 15:55:57 UTC
Description of problem:

We are hitting following issue after installing python-requests-2.6.0-5.el7_5.noarch

Original traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/osbs/http.py", line 59, in request
    stream = HttpStream(url, *args, verbose=self.verbose, **kwargs)
  File "/usr/lib/python2.7/site-packages/osbs/http.py", line 156, in __init__
    self.req = self.session.request(method, url, **args)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 370, in send
    timeout=timeout
  File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 597, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python2.7/site-packages/urllib3/util/retry.py", line 226, in increment
    total -= 1
TypeError("unsupported operand type(s) for -=: 'Retry' and 'int'",)


Replacing
- from requests.packages.urllib3.util import Retry
+ from urllib3.util import Retry
Fixes issue for us


Version-Release number of selected component (if applicable):
python-requests-2.6.0-5.el7_5.noarch

How reproducible:


Steps to Reproduce:
1. Use retry from requests module
2. Force code to retry request
3.

Actual results:
Traceback


Expected results:
Properly retried query

Additional info:
It seems that this was fixed in https://bugzilla.redhat.com/show_bug.cgi?id=1776292 but with python-requests-2.6.0-5.el7_5.noarch we are hitting the same issue. So maybe it was fixed only partially

Comment 9 Petr Viktorin (pviktori) 2020-01-28 14:54:06 UTC
The patch to make `import requests.packages` work is ready. It should solve the the Pulp 2 issue.

Would you be able to test an RPM if we send one to you?

Comment 11 external.z17jmagn 2020-01-28 17:09:27 UTC
Hello,
I have the same error with newer version.

OS Version : CentOS V7.7
python-requests  2.6.0-7.el7_7

Log from /var/log/messages
141360 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976) unsupported operand type(s) for -=: 'Retry' and 'int'
141361 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976) Traceback (most recent call last):
141362 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)   File "/usr/lib/python2.7/site-packages/nectar/downloaders/threaded.py", line 274, in _fetch
141363 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)     **requests_kwargs)
141364 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 498, in get
141365 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)     return self.request('GET', url, **kwargs)
141366 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 486, in request
141367 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)     resp = self.send(prep, **send_kwargs)
141368 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 598, in send
141369 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)     r = adapter.send(request, **kwargs)
141370 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)   File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 370, in send
141371 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)     timeout=timeout
141372 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)   File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 597, in urlopen
141373 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)     _stacktrace=sys.exc_info()[2])
141374 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)   File "/usr/lib/python2.7/site-packages/urllib3/util/retry.py", line 236, in increment
141375 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976)     total -= 1
141376 Jan 28 16:56:29 rtdkh1kat01 pulp: nectar.downloaders.threaded:ERROR: (31721-50976) TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Comment 12 external.z17jmagn 2020-01-28 17:12:07 UTC
Error about python-requests :

Tested version :  python-requests  2.6.0-8.el7.7

Comment 14 external.z17jmagn 2020-01-30 10:54:07 UTC
Hello All,
I have continued my testing and found a workaround.

python-requests 2.6.0-8.el7.7           Error
python-requests 2.6.0-7.el7.7           It works fine

Pulp operation run without error

Comment 30 Jan Houska 2020-05-24 19:57:03 UTC
VERIFIED:
all modules from comment 23 was successfully  loaded. 


version:
python-requests-2.6.0-10.el7.noarch

Comment 34 errata-xmlrpc 2020-09-29 19:39:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (python-requests bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:3886


Note You need to log in before you can comment on or make changes to this bug.