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.

Cannot import cheroot.ssl.pyopenssl

See original GitHub issue

On Windows 10, using Python 3.4, cheroot 5.1 import cheroot.ssl.pyopenssl fails:

(wsgidav34) C:\Prj\git\wsgidav>pip list
cheroot (5.1.0)
defusedxml (0.5.0)
pip (9.0.1)
portend (1.8)
pypiwin32 (219)
pytz (2016.10)
setuptools (18.2)
six (1.10.0)
tempora (1.6.1)
WsgiDAV (2.1.1.dev20170218, c:\prj\git\wsgidav)

(wsgidav34) C:\Prj\git\wsgidav>python
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cheroot
>>> import cheroot.ssl.pyopenssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\prj\env\wsgidav34\lib\site-packages\cheroot\ssl\pyopenssl.py", line 49, in <module>
    class SSL_fileobject(MakeFile):
TypeError: function() argument 1 must be code, not str
>>>

It looks like the problem is in makefile.py, where a function object is assigned to MakeFile

def MakeFile_PY3(sock, mode='r', bufsize=io.DEFAULT_BUFFER_SIZE):
    if 'r' in mode:
        return io.BufferedReader(socket.SocketIO(sock, mode), bufsize)
    else:
        return BufferedWriter(socket.SocketIO(sock, mode), bufsize)

[...]
MakeFile = MakeFile_PY2 if six.PY2 else MakeFile_PY3

and then in pyopenssl.py this function is used as a base class?

from ..makefile import MakeFile

class SSL_fileobject(MakeFile):
    [...]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mar10commented, Apr 24, 2017

Hi Sviatoslav it is not hi prio on my list either, but I will take a note and may be help out sometime later…

0reactions
webknjazcommented, Sep 3, 2018

The initial problem of not being able to import has been solved. Closing in favor of #113, which is more about fixing the adapter itself now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cheroot.ssl.pyopenssl module
A library for integrating pyOpenSSL with Cheroot. The OpenSSL module must be importable for SSL/TLS/HTTPS functionality. You can obtain it from here.
Read more >
Both builtin and pyopensssl doesn't work with cherrypy
Yes! I had the same problem serving images and found the answer here: https://github.com/cherrypy/cheroot/issues/245.
Read more >
SSL without installing pyOpenSSL with custom scripts ?
cant access internet do download pyOpenSSL after running command as ... But HUE still cant recognize that it's installed: ... from OpenSSL import...
Read more >
python2-pyopenssl - AUR (en) - Arch Linux
_openssl import ffi, lib INTERNALERROR> ImportError: /usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/_openssl.so: undefined ...
Read more >
CherryPy Documentation - Read the Docs
ssl – for OpenSSL bindings, useful in Python environments not having the ... (by creating a module and importing classes from cheroot).
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