SSLError: Not a directory
I am using the excellent requests module in an embedded version of Python 2.7 in a C++ application on Mac OS. My code runs fine on my Mac, but it doesn't on a client's machine. He is using the same version of Python and the C++ host application. The error he gets with the following URL is:
http://www.hantmade.com/backstage/thumb/1450544739_Impression%20XL%20300%20RZ.stage.png Traceback (most recent call last): File "'hantmade-storage.pyp'", line 1468, in online_load_thumbnail File "c:\maxon\cinema 4d r16 dev\plugins\hantmade_storage\devel\requests/requests\api.py", line 69, in get File "c:\maxon\cinema 4d r16 dev\plugins\hantmade_storage\devel\requests/requests\api.py", line 50, in request File "c:\maxon\cinema 4d r16 dev\plugins\hantmade_storage\devel\requests/requests\sessions.py", line 468, in request File "c:\maxon\cinema 4d r16 dev\plugins\hantmade_storage\devel\requests/requests\sessions.py", line 597, in send File "c:\maxon\cinema 4d r16 dev\plugins\hantmade_storage\devel\requests/requests\sessions.py", line 195, in resolve_redirects File "c:\maxon\cinema 4d r16 dev\plugins\hantmade_storage\devel\requests/requests\sessions.py", line 576, in send File "c:\maxon\cinema 4d r16 dev\plugins\hantmade_storage\devel\requests/requests\adapters.py", line 433, in send SSLError: [Errno 20] Not a directory
Note: The absolute Windows-style paths seem to stem from the fact that the requests module is loaded from a set of .pyc files and apparently the original source file's path is compiled into them.
Once again, I can not reproduce this issue on my Mac unfortunately. Where could this error come from? Why "not a directory"? Are there any steps to debugging this problem?
If necessary, I can log into the client's machine via TeamViewer and modify the source code to debug the problem, only I didn't feel the need for it yet since I am completely puzzled by this error.
Suddenly the I also get an SSLError and the message on the side of my client has changed also. Strangely, nothing really changed in the code. I'll keep on googling, these error messages appear to be informative and eventually there are already discussions about them.
What my client sees:
SSLError: [Errno 185090050] _ssl.c:326: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
What I see:
SSLError: [Errno 1] _ssl.c:480: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm
For the "Not a directory" error, we figured that the distributed version of the software did not pack the request module's cacert.pem file into the Python Egg. That was one issue.
The other issue seems to be that when using Python 2.6 or older, the ssl module failed to communicate with the server. I was able to solve this by compiling the Python SSL module manually in a newer version. Since the software runs in an embedded version of Python, I can't just go bonkers with the dependencies and make my software as encapsulated as possible. I use my _localimport class to temporarily remove the original ssl module, import the new compiled ssl module and requests.
with _localimport(lib_path) as importer: importer.disable(['ssl', 'requests']) import ssl, requests assert issubpath(ssl.__file__, lib_path) assert issubpath(requests.__file__, lib_path)
libs/ ssl-1.16-macosx-10.5-x86_64-2.6.egg requests-v2.9.1.egg
Note that these problems with SSL only ocurred on Mac.