broken fetch in 2.18.3?

23 views
Skip to first unread message

Dave S

unread,
Mar 12, 2019, 6:23:50 AM3/12/19
to web2py-users
In moving my application to 2.18.3 (windows exe kit, stable+timestamp.2019.03.03.23.22.30), I'm getting the following exception:

 File "applications\badlist\modules\restuff.py", line 51, in restuff
 bin
=fetch(url)
 
File "C:\Users\Dave\web2py_win\web2py_win.2-18-3\web2py\gluon\tools.py", line 4635, in fetch
 html
= urlopen(req).read()
 
File "urllib.py", line 87, in urlopen
 
File "urllib.py", line 185, in open
 
File "urllib.py", line 1066, in unwrap
 
File "urllib2.py", line 256, in __getattr__
AttributeError: strip
<type 'exceptions.AttributeError'>(strip)

In 2.14.6, tools.py L4635 (which was L5226 back then) read as
html = urllib2.urlopen(req).read()
and in 2.18.3 this has been changed to (as shown above)|
 html = urlopen(req).read()

where urlopen is from pydal/_compat.py (in the if PY2 case)
 from urllib.request import FancyURLopener, urlopen

I suspect something is missing that's relevant to the change.   In my line 51, url is a string that's ultimately from a form field, and the fetch is for an image file (binary, hence stored in the cleverly named bin).

I'm not currently using fetch() on a linux system, and haven't install Python3 on Windows, so I haven't tried the PY3 environment.

/dps


(Off-topic:  the Google Groups post editor seems to be wanting to play with formatting my message in funny ways, including changing to "small" unpredictably.  I'm not sure I've overridden its choices.)

Reply all
Reply to author
Forward
0 new messages