question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: cannot instantiate ctype 'EVP_MD_CTX' of unknown size

See original GitHub issue

I have a script that runs gspread. It normally works fine, but now it’s throwing this exception.

I’m trying to figure out if it’s an issue with my credentials (which I don’t believe have changed, though it’s possible someone on the team did), another sudden change in Google’s API or certificates, or something else.

Either way, ideally the exception itself would be nicer.

Any ideas? Did this start happening for anyone else?

  File "app/gspread_util.py", line 56, in get_gspread_client
    gc = gspread.authorize(gspread_credentials)
  File "/app/venv/local/lib/python2.7/site-packages/gspread/client.py", line 335, in authorize
    client.login()
  File "/app/venv/local/lib/python2.7/site-packages/gspread/client.py", line 98, in login
    self.auth.refresh(http)
  File "/app/venv/local/lib/python2.7/site-packages/oauth2client/client.py", line 598, in refresh
    self._refresh(http.request)
  File "/app/venv/local/lib/python2.7/site-packages/oauth2client/client.py", line 769, in _refresh
    self._do_refresh_request(http_request)
  File "/app/venv/local/lib/python2.7/site-packages/oauth2client/client.py", line 795, in _do_refresh_request
    body = self._generate_refresh_request_body()
  File "/app/venv/local/lib/python2.7/site-packages/oauth2client/client.py", line 1425, in _generate_refresh_request_body
    assertion = self._generate_assertion()
  File "/app/venv/local/lib/python2.7/site-packages/oauth2client/client.py", line 1554, in _generate_assertion
    private_key, self.private_key_password), payload)
  File "/app/venv/local/lib/python2.7/site-packages/oauth2client/crypt.py", line 380, in make_signed_jwt
    signature = signer.sign(signing_input)
  File "/app/venv/local/lib/python2.7/site-packages/oauth2client/crypt.py", line 146, in sign
    return crypto.sign(self._key, message, 'sha256')
  File "/app/venv/local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 2403, in sign
    md_ctx = _ffi.new("EVP_MD_CTX*")
TypeError: cannot instantiate ctype 'EVP_MD_CTX' of unknown size

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9

github_iconTop GitHub Comments

21reactions
gwcommented, Aug 29, 2016

The cryptography package just changed.

Our temp workaround is to peg cryptography==1.4 in requirements.txt.

8reactions
joooncommented, Sep 13, 2016

Upgrading to pyopenssl==16.1.0 will also fix this. pyopenssl has a versioned dependency on cryptography, but there is no way for cryptography to say it needs to be used by a certain version of pyopenssl (like package conflicts in debian). Pinning cryptography if you pin pyopenssl seems to be a good idea regardless.

In general I recommend http://www.kennethreitz.org/essays/a-better-pip-workflow for python app development. Pin everything that is downloaded by pip in requirements.txt for stability, but have a requirements-to-freeze.txt for actual api dependencies that your app needs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot instantiate ctype 'EVP_MD_CTX' of unknown size ...
I found this post oauth2client relating the problem, in my case the problem was solved updating to latest version of pyOpenSSL, 16.2.0 at...
Read more >
Cannot instantiate ctype 'EVP_MD_CTX' of unknown size - Help
Hi guys! I had my certificate ok on my debian jessie server, but now I get: $ sudo certbot certificates Saving debug log...
Read more >
[pypy-dev] Cannot instantiate ctype 'struct *' of unknown size
Previous message (by thread): [pypy-dev] Cannot instantiate ctype 'struct *' of unknown size; Next message (by thread): [pypy-dev] Cannot ...
Read more >
Forward declaration of struct does not always work - Projects
But if I uncomment the line with ffi.cast() , I get the error: TypeError: cannot instantiate ctype 'struct api_ret *' of unknown size....
Read more >
opaque pointers - Google Groups
TypeError : cannot instantiate ctype 'void' of unknown size. This clearly works in C source. I am working around it like this: _...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found