pepper icon indicating copy to clipboard operation
pepper copied to clipboard

TypeError: urlopen() got an unexpected keyword argument 'context'

Open PhilipSchmid opened this issue 7 years ago • 3 comments

Hi there I'm currently running in the following error:

err@2dbc493bfb79:~$ pepper '*' test.ping --ignore-ssl-errors -H -vvv       
urlopen() got an unexpected keyword argument 'context'
Uncaught Pepper error (increase verbosity for the full traceback).
Uncaught traceback:
Traceback (most recent call last):
  File "/app/venv/bin/pepper", line 26, in <module>
    exit_code, results = cli.run()
  File "/app/venv/lib/python3.4/site-packages/pepper/cli.py", line 373, in run
    auth = api.login(*list(creds))
  File "/app/venv/lib/python3.4/site-packages/pepper/libpepper.py", line 330, in login
    'eauth': eauth}).get('return', [{}])[0]
  File "/app/venv/lib/python3.4/site-packages/pepper/libpepper.py", line 134, in req
    f = urlopen(req, context=con)
TypeError: urlopen() got an unexpected keyword argument 'context'
DEBUG 2016-10-27 22:38:52,101 pepper: Uncaught traceback:
Traceback (most recent call last):
  File "/app/venv/bin/pepper", line 26, in <module>
    exit_code, results = cli.run()
  File "/app/venv/lib/python3.4/site-packages/pepper/cli.py", line 373, in run
    auth = api.login(*list(creds))
  File "/app/venv/lib/python3.4/site-packages/pepper/libpepper.py", line 330, in login
    'eauth': eauth}).get('return', [{}])[0]
  File "/app/venv/lib/python3.4/site-packages/pepper/libpepper.py", line 134, in req
    f = urlopen(req, context=con)
TypeError: urlopen() got an unexpected keyword argument 'context'

I installed pepper directly over the Github repo:

err@2dbc493bfb79:~$ python --version
Python 3.4.2
err@2dbc493bfb79:~$ pip install git+https://github.com/saltstack/pepper.git
Collecting git+https://github.com/saltstack/pepper.git
  Cloning https://github.com/saltstack/pepper.git to /tmp/pip-r9dfl769-build
Installing collected packages: salt-pepper
  Running setup.py install for salt-pepper ... done
Successfully installed salt-pepper-0.4.1.dev22

Do you perhaps have any idea how to fix this issue?

Thanks & regards,

Philip

PhilipSchmid avatar Oct 27 '16 22:10 PhilipSchmid

Any updates on this? Do you need further information? If so, what exactly?

Thanks, Philip

PhilipSchmid avatar Nov 03 '16 17:11 PhilipSchmid

Sorry for the slow reply!

Hm. It seems the context arg was removed in Python 3.0-3.3 but reintroduced in 3.4. Looks like we'll need a method of not verifying certs that works across 2, 3.0-3.3, and also 3.4+. 😵

whiteinge avatar Dec 29 '16 22:12 whiteinge

Different versions of urllib support / don't support 'context'. You could throw a try statement on the urlopen(), and remove context from kwargs on the except.

kuberry avatar Aug 09 '21 14:08 kuberry

Stale. Not interested anymore.

PhilipSchmid avatar Jun 21 '23 17:06 PhilipSchmid