Bug 5102 - python2.5 is not compiled with ssl support: ssl module missing
: python2.5 is not compiled with ssl support: ssl module missing
Status: RESOLVED INVALID
Product: PyMaemo
General
: unspecified
: All Linux
: Low normal (vote)
: ---
Assigned To: Anderson Lizardo
: general
:
:
:
:
  Show dependency tree
 
Reported: 2009-09-06 17:51 UTC by Andrea Grandi
Modified: 2009-11-25 09:54 UTC (History)
2 users (show)

See Also:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description Andrea Grandi (reporter) 2009-09-06 17:51:26 UTC
SOFTWARE VERSION:
(Control Panel > General > About product)

STEPS TO REPRODUCE THE PROBLEM:

From Scratchbox shell execute:

[sbox-FREMANTLE_X86: ~] > python2.5
Python 2.5.2 (r252:60911, Mar 16 2009, 16:36:21) 
[GCC 4.2.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named ssl

EXPECTED OUTCOME:

ssl module imported without any error

ACTUAL OUTCOME:

ImportError: No module named ssl

REPRODUCIBILITY:

always

OTHER COMMENTS:

we should release a python2.5 version, compiled with ssl support.
I need to use urllib2 to scrape a website that requires ssl support.. without
it I cannot implement my utility.
Comment 1 Anderson Lizardo 2009-09-21 22:13:52 UTC
Strange, this does not work even on my Desktop:

$ python -c "import ssl"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named ssl

(Ubuntu 8.04.3 LTS)

Are you sure this is the correct way to use SSL? If possible, add here a
testcase that uses urllib2 on a https website and that works on a Desktop, but
not on Maemo.
Comment 2 Andrea Grandi (reporter) 2009-09-21 22:48:35 UTC
(In reply to comment #1)
> Strange, this does not work even on my Desktop:
> 
> $ python -c "import ssl"
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> ImportError: No module named ssl
> 
> (Ubuntu 8.04.3 LTS)
> 
> Are you sure this is the correct way to use SSL? If possible, add here a
> testcase that uses urllib2 on a https website and that works on a Desktop, but
> not on Maemo.
> 

a friend of mine told me to do that to see if Python was compiled with SSL
support...  still have to organize the code of my library, but I'll try to
provide you an example as soon as possibile.
Comment 3 Andrea Grandi (reporter) 2009-09-27 00:58:05 UTC
(In reply to comment #1)
> Strange, this does not work even on my Desktop:
> 
> $ python -c "import ssl"
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
> ImportError: No module named ssl
> 
> (Ubuntu 8.04.3 LTS)
> 
> Are you sure this is the correct way to use SSL? If possible, add here a
> testcase that uses urllib2 on a https website and that works on a Desktop, but
> not on Maemo.
> 

This lines you'll read, works perfectly on my Ubuntu and not under Scratchbox
(as you can see):

[sbox-FREMANTLE_X86: ~] > python2.5
Python 2.5.2 (r252:60911, Mar 16 2009, 16:36:21) 
[GCC 4.2.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> from urllib import urlencode
>>> opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
>>> login_url = 'https://www.simyo.es/simyo/portal/action/login'
>>> cookie_req = urllib2.Request(login_url)
>>> cookie_response = opener.open(cookie_req)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/urllib2.py", line 381, in open
    response = self._open(req, data)
  File "/usr/lib/python2.5/urllib2.py", line 399, in _open
    '_open', req)
  File "/usr/lib/python2.5/urllib2.py", line 360, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.5/urllib2.py", line 1115, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.5/urllib2.py", line 1082, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error (-3, 'Temporary failure in name resolution')>
>>>
Comment 4 Lucas Maneos 2009-09-27 12:44:58 UTC
(In reply to comment #3)
> urllib2.URLError: <urlopen error (-3, 'Temporary failure in name resolution')>

Isn't this just another case of bug 3755?
Comment 6 Lucas Maneos 2009-09-27 12:52:18 UTC
Strange, your example seems to work here:

[sbox-FREMANTLE_X86: ~] > python2.5 
Python 2.5.4 (r254:67916, Jul 30 2009, 23:52:54) 
[GCC 4.2.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
>>> from urllib import urlencode
>>> opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
>>> login_url = 'https://www.simyo.es/simyo/portal/action/login'
>>> cookie_req = urllib2.Request(login_url)
>>> cookie_response = opener.open(cookie_req)
>>> print cookie_response
<addinfourl at 4155107820L whose fp = <socket._fileobject object at
0xf7af93e4>>
>>>
Comment 7 Andrea Grandi (reporter) 2009-09-27 13:04:44 UTC
(In reply to comment #6)
> Strange, your example seems to work here:
> 
> [sbox-FREMANTLE_X86: ~] > python2.5 
> Python 2.5.4 (r254:67916, Jul 30 2009, 23:52:54) 
> [GCC 4.2.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import urllib2
> >>> from urllib import urlencode
> >>> opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
> >>> login_url = 'https://www.simyo.es/simyo/portal/action/login'
> >>> cookie_req = urllib2.Request(login_url)
> >>> cookie_response = opener.open(cookie_req)
> >>> print cookie_response
> <addinfourl at 4155107820L whose fp = <socket._fileobject object at
> 0xf7af93e4>>
> >>> 
> 

the correct example should be: print cookie_response.read()
but anyway I don't reach that line... now I'm trying with another example that
doesn't use https, I'll let you know...
Comment 8 Andrea Grandi (reporter) 2009-09-27 13:08:50 UTC
(In reply to comment #7)
> the correct example should be: print cookie_response.read()
> but anyway I don't reach that line... now I'm trying with another example that
> doesn't use https, I'll let you know...
> 

yes same error even without https :(
Comment 9 Lucas Maneos 2009-09-27 13:11:22 UTC
Hm, we seem to have different versions of "python2.5":

(In reply to comment #3)
> [sbox-FREMANTLE_X86: ~] > python2.5
> Python 2.5.2 (r252:60911, Mar 16 2009, 16:36:21) 
> [GCC 4.2.1] on linux2

(In reply to comment #6)
> [sbox-FREMANTLE_X86: ~] > python2.5 
> Python 2.5.4 (r254:67916, Jul 30 2009, 23:52:54) 
> [GCC 4.2.1] on linux2

Mine came from extras-devel, but even after downgrading it manually it still
works - print cookie_response.read() outputs a long-ish HTML document titled
"simyo - My simyo. Login".

Can you put the above python lines in a script and strace it to see where it
fails?  In particular, does it open /etc/resolv.conf and send a DNS query to
the nameserver listed there?
Comment 10 Andrea Grandi (reporter) 2009-09-27 13:16:02 UTC
(In reply to comment #9)
> Hm, we seem to have different versions of "python2.5":
> 
> (In reply to comment #3)
> > [sbox-FREMANTLE_X86: ~] > python2.5
> > Python 2.5.2 (r252:60911, Mar 16 2009, 16:36:21) 
> > [GCC 4.2.1] on linux2
> 
> (In reply to comment #6)
> > [sbox-FREMANTLE_X86: ~] > python2.5 
> > Python 2.5.4 (r254:67916, Jul 30 2009, 23:52:54) 
> > [GCC 4.2.1] on linux2
> 
> Mine came from extras-devel, but even after downgrading it manually it still
> works - print cookie_response.read() outputs a long-ish HTML document titled
> "simyo - My simyo. Login".
> 
> Can you put the above python lines in a script and strace it to see where it
> fails?  In particular, does it open /etc/resolv.conf and send a DNS query to
> the nameserver listed there?
> 

hi, now the code is in a script. Could you please tell me how to execute the
"strace"? Thanks!
Comment 11 Andrea Grandi (reporter) 2009-09-27 13:21:52 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Hm, we seem to have different versions of "python2.5":
> > 
> > (In reply to comment #3)
> > > [sbox-FREMANTLE_X86: ~] > python2.5
> > > Python 2.5.2 (r252:60911, Mar 16 2009, 16:36:21) 
> > > [GCC 4.2.1] on linux2
> > 
> > (In reply to comment #6)
> > > [sbox-FREMANTLE_X86: ~] > python2.5 
> > > Python 2.5.4 (r254:67916, Jul 30 2009, 23:52:54) 
> > > [GCC 4.2.1] on linux2
> > 
> > Mine came from extras-devel, but even after downgrading it manually it still
> > works - print cookie_response.read() outputs a long-ish HTML document titled
> > "simyo - My simyo. Login".
> > 
> > Can you put the above python lines in a script and strace it to see where it
> > fails?  In particular, does it open /etc/resolv.conf and send a DNS query to
> > the nameserver listed there?
> > 
> 
> hi, now the code is in a script. Could you please tell me how to execute the
> "strace"? Thanks!
> 

I found by myself :)
this is the output of strace: http://pastebin.com/m6fe5c281
I hope it can help you!
Comment 12 Lucas Maneos 2009-09-27 13:38:46 UTC
Thanks, it looks like a DNS problem after all - it sends a DNS query for
www.simyo.es, doesn't receive a reply, retries 3 times and finally aborts.

Is 127.0.0.1 the correct nameserver to use, and does "host www.simyo.es"
(apt-get install host if necessary) also fail?
Comment 13 Andrea Grandi (reporter) 2009-09-27 13:45:12 UTC
(In reply to comment #12)
> Thanks, it looks like a DNS problem after all - it sends a DNS query for
> www.simyo.es, doesn't receive a reply, retries 3 times and finally aborts.
> 
> Is 127.0.0.1 the correct nameserver to use, and does "host www.simyo.es"
> (apt-get install host if necessary) also fail?
> 

of course 127.0.0.1 is not the correct nameserver. I copied my machine's
resolv.conf to /scratchbox/etc but this is not enough as I can see. Fixing the
dns, the script can run without problems.

This dsn problem is very annoying :(
Comment 14 Lucas Maneos 2009-09-27 13:52:25 UTC
(In reply to comment #13)
> of course 127.0.0.1 is not the correct nameserver. I copied my machine's
> resolv.conf to /scratchbox/etc but this is not enough as I can see. Fixing the
> dns, the script can run without problems.

Thanks, closing then.

> This dsn problem is very annoying :(

It looks like it will be resolved sooner or later, but feel free to vote for
bug 3755 in the meantime.
Comment 15 Andre Klapper maemo.org 2009-11-25 09:54:50 UTC
Hiding token codes as requested. Please do not post token codes in public.