sugarlabs / sugar-toolkit-gtk3

Sugar Learning Environment, Activity Toolkit, GTK 3.
GNU Lesser General Public License v2.1
21 stars 80 forks source link

urllilb.request.urlopen doesn't run interactively #447

Closed chimosky closed 4 years ago

chimosky commented 4 years ago

Noticed this while looking at getiabooks activity.

Steps to reproduce.

@quozl

quozl commented 4 years ago

The line you refer to reads;

    self._info = urllib.request.urlopen(self._url)

What string value are you using in place of self._url?

The line works for me;

>>> import urllib.request
>>> r = urllib.request.urlopen('https://sugarlabs.org/')
>>> █

The line has run interactively.

The line looks fine according to the documentation.

chimosky commented 4 years ago

Earlier I was using this link

http://www.archive.org/advancedsearch.php?q=%28title%3A%28a%29%20OR%20creator%3A%28a%29%29%20AND%20format%3A%28DJVU%29&fl%5B%5D=creator&fl%5B%5D=description&fl%5B%5D=format&fl%5B%5D=identifier&fl%5B%5D=language&fl%5B%5D=publisher&fl%5B%5D=subject&fl%5B%5D=title&fl%5B%5D=volume&sort%5B%5D=title&sort%5B%5D&sort%5B%5D=&rows=500&save=yes&fmt=csv&xmlsearch=Search

It seems just importing urllib and trying to access request from there doesn't work, I tried this earlier and it still returns the same result.

>>> import urllib
>>> urllib.request.urlopen
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'urllib' has no attribute 'request'

This works as expected.

>>> import urllib.request
>>> urllib.request.urlopen