Home Download Buy Blog Forum Support

Python SSL Module

Python SSL Module

Postby wbond on Wed Aug 03, 2011 1:03 pm

When I try to import the ssl module for use in a package I am getting an import error about no module named _ssl. It appears there is an ssl.pyo in the Sublime Text 2/lib/python26.zip file, so I'm unsure if this is a bug or if the bundled version of Python was not compiled with SSL support.
wbond
 
Posts: 528
Joined: Mon Feb 28, 2011 5:33 am

Re: Python SSL Module

Postby wbond on Thu Aug 04, 2011 3:56 pm

So this appears to only be an issue on Linux. I ended up working around it for now by creating wrappers for curl and wget and using those when I encounter https URLs and the ssl module won't import.
wbond
 
Posts: 528
Joined: Mon Feb 28, 2011 5:33 am

Re: Python SSL Module

Postby krim on Mon Sep 12, 2011 12:17 pm

have the same bug.
I want to use sublime github and then i did commit i saw
Code: Select all
Traceback (most recent call last):
  File "./gist.py", line 148, in on_done
  File "./gist.py", line 76, in create
AttributeError: 'module' object has no attribute 'HTTPSConnection'



And when i import ssl i saw:

Code: Select all
>>> import ssl
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/sublime-text-2/lib/python26.zip/ssl.py", line 60, in <module>
ImportError: No module named _ssl



Can i use python from my system unless python26.zip from "lib"?
Last edited by krim on Mon Sep 12, 2011 12:44 pm, edited 2 times in total.
krim
 
Posts: 3
Joined: Mon Sep 12, 2011 11:55 am

Re: Python SSL Module

Postby wbond on Mon Sep 12, 2011 12:40 pm

I spoke with Jon about this and he said that he had to remove it for Linux builds because of issues with different people who either didn't have openssl or a different version, etc. I ended up writing three downloader classes, one for urllib2, one that wraps curl and one that wraps wget. Since Linux is the only affected platform and most Linux users have either Curl or Wget installed, it seems to have worked out pretty well. You can check out the Package Control source if you want to grab some code to start with: https://github.com/wbond/sublime_packag ... ol.py#L340
wbond
 
Posts: 528
Joined: Mon Feb 28, 2011 5:33 am

Re: Python SSL Module

Postby krim on Mon Sep 12, 2011 12:49 pm

wbond wrote:I spoke with Jon about this and he said that he had to remove it for Linux builds because of issues with different people who either didn't have openssl or a different version, etc. I ended up writing three downloader classes, one for urllib2, one that wraps curl and one that wraps wget. Since Linux is the only affected platform and most Linux users have either Curl or Wget installed, it seems to have worked out pretty well. You can check out the Package Control source if you want to grab some code to start with: https://github.com/wbond/sublime_packag ... ol.py#L340

So, we need to wait Jon? Or i can fix that from myself? Can i use python from my system unless python26.zip from "lib"?
krim
 
Posts: 3
Joined: Mon Sep 12, 2011 11:55 am

Re: Python SSL Module

Postby bgreenlee on Thu Sep 15, 2011 7:24 pm

I updated sublime-github to try to use curl if SSL support isn't compiled into python. I borrowed some chunks of wbond's code for it (thanks!).

https://github.com/bgreenlee/sublime-gi ... 44850e2343

I didn't bother with wget, since I believe curl is more common. If someone desperately needs wget support for some reason, I can add it.
bgreenlee
 
Posts: 22
Joined: Wed Jul 20, 2011 8:02 pm
Location: Seattle, WA

Re: Python SSL Module

Postby krim on Fri Sep 16, 2011 6:06 pm

bgreenlee, thanks.
But not work for me.
In console:
Code: Select all
Traceback (most recent call last):
  File "./gist.py", line 160, in on_done
  File "./gist.py", line 90, in create
  File "./curl.py", line 26, in post
NameError: global name 'error_message' is not defined

If i comment error_message on curl.py, i see in console:
Code: Select all
Traceback (most recent call last):
  File "./gist.py", line 160, in on_done
  File "./gist.py", line 91, in create
  File ".\re.py", line 137, in match
TypeError: expected string or buffer
krim
 
Posts: 3
Joined: Mon Sep 12, 2011 11:55 am

Re: Python SSL Module

Postby bgreenlee on Mon Sep 19, 2011 11:21 pm

@krim: Ok, I'll set up a Linux VM to test this out on (works for me on OS X). What are you running?
bgreenlee
 
Posts: 22
Joined: Wed Jul 20, 2011 8:02 pm
Location: Seattle, WA


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests