J
John F Dutcher
Can anyone comment on why the code shown in the Python error is in
some way incorrect...or is there a problem with Python on my hoster's
site ??
The highlites don't seem to show here...but line #80 and line # 38 are
the first line offenders.
--> --> -->
HTTPError Python 2.2.2: /usr/bin/python
Fri Jun 4 13:58:00 2004
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
/home/euromill/public_html/scgi-bin/euro3.py
78 write_dig_err(ls)
79 x = x + 1
80 process_request(ls)
81
82
process_request = <function process_request>, ls =
['johnfdutchfrederic', ['77', '77', '77', '77', '77', '77', '77'],
'EuroMillions', '5', 'error']
/home/euromill/public_html/scgi-bin/euro3.py in
process_request(ls=['johnfdutchfrederic', ['77', '77', '77', '77',
'77', '77', '77'], 'EuroMillions', '5', 'error'])
36 req = urllib2.Request(url='http://www.euromillions.us/scgi-bin/euro8.py',
\
37 data = strdata)
38 f = urllib2.urlopen(req)
39 print "Content-type: text/html\n\n"
40 print f.read()
f undefined, global urllib2 = <module 'urllib2' from
'/usr/lib/python2.2/urllib2.pyc'>, urllib2.urlopen = <function
urlopen>, req = <urllib2.Request instance>
/usr/lib/python2.2/urllib2.py in urlopen(url=<urllib2.Request
instance>, data=None)
136 if _opener is None:
137 _opener = build_opener()
138 return _opener.open(url, data)
139
140 def install_opener(opener):
global _opener = <urllib2.OpenerDirector instance>, _opener.open =
<bound method OpenerDirector.open of <urllib2.OpenerDirector
instance>>, url = <urllib2.Request instance>, data = None
/usr/lib/python2.2/urllib2.py in open(self=<urllib2.OpenerDirector
instance>, fullurl=<urllib2.Request instance>, data=None)
320 type_ = req.get_type()
321 result = self._call_chain(self.handle_open, type_, type_
+ \
322 '_open', req)
323 if result:
324 return result
req = <urllib2.Request instance>
/usr/lib/python2.2/urllib2.py in
_call_chain(self=<urllib2.OpenerDirector instance>, chain={'do':
[<urllib2.HTTPHandler instance>, <urllib2.HTTPSHandler instance>],
'file': [<urllib2.FileHandler instance>], 'ftp': [<urllib2.FTPHandler
instance>], 'http': [<urllib2.HTTPHandler instance>], 'https':
[<urllib2.HTTPSHandler instance>], 'proxy': [<urllib2.ProxyHandler
instance>], 'unknown': [<urllib2.UnknownHandler instance>]},
kind='http', meth_name='http_open', *args=(<urllib2.Request
instance>,))
299 func = getattr(handler, meth_name)
300
301 result = func(*args)
302 if result is not None:
303 return result
result undefined, func = <bound method HTTPHandler.http_open of
<urllib2.HTTPHandler instance>>, args = (<urllib2.Request instance>,)
/usr/lib/python2.2/urllib2.py in http_open(self=<urllib2.HTTPHandler
instance>, req=<urllib2.Request instance>)
788
789 def http_open(self, req):
790 return self.do_open(httplib.HTTP, req)
791
792
self = <urllib2.HTTPHandler instance>, self.do_open = <bound method
HTTPHandler.do_open of <urllib2.HTTPHandler instance>>, global httplib
= <module 'httplib' from '/usr/lib/python2.2/httplib.pyc'>,
httplib.HTTP = <class httplib.HTTP>, req = <urllib2.Request instance>
/usr/lib/python2.2/urllib2.py in do_open(self=<urllib2.HTTPHandler
instance>, http_class=<class httplib.HTTP>, req=<urllib2.Request
instance>)
782 return addinfourl(fp, hdrs, req.get_full_url())
783 else:
784 return self.parent.error('http', req, fp, code, msg,
hdrs)
785
786
self = <urllib2.HTTPHandler instance>, self.parent =
<urllib2.OpenerDirector instance>, self.parent.error = <bound method
OpenerDirector.error of <urllib2.OpenerDirector instance>>, req =
<urllib2.Request instance>, fp = <open file '<socket>', mode 'rb'>,
code = 500, msg = 'Internal Server Error', hdrs = <httplib.HTTPMessage
instance>
/usr/lib/python2.2/urllib2.py in error(self=<urllib2.OpenerDirector
instance>, proto=500, *args=({301: [<urllib2.HTTPRedirectHandler
instance>], 302: [<urllib2.HTTPRedirectHandler instance>], 'default':
[<urllib2.HTTPDefaultErrorHandler instance>]}, 'default',
'http_error_default', <urllib2.Request instance>, <open file
'<socket>', mode 'rb'>, 500, 'Internal Server Error',
<httplib.HTTPMessage instance>))
346 if http_err:
347 args = (dict, 'default', 'http_error_default') +
orig_args
348 return self._call_chain(*args)
349
350 # XXX probably also want an abstract factory that knows things
like
self = <urllib2.OpenerDirector instance>, self._call_chain = <bound
method OpenerDirector._call_chain of <urllib2.OpenerDirector
instance>>, args = ({301: [<urllib2.HTTPRedirectHandler instance>],
302: [<urllib2.HTTPRedirectHandler instance>], 'default':
[<urllib2.HTTPDefaultErrorHandler instance>]}, 'default',
'http_error_default', <urllib2.Request instance>, <open file
'<socket>', mode 'rb'>, 500, 'Internal Server Error',
<httplib.HTTPMessage instance>)
/usr/lib/python2.2/urllib2.py in
_call_chain(self=<urllib2.OpenerDirector instance>, chain={301:
[<urllib2.HTTPRedirectHandler instance>], 302:
[<urllib2.HTTPRedirectHandler instance>], 'default':
[<urllib2.HTTPDefaultErrorHandler instance>]}, kind='default',
meth_name='http_error_default', *args=(<urllib2.Request instance>,
<open file '<socket>', mode 'rb'>, 500, 'Internal Server Error',
<httplib.HTTPMessage instance>))
299 func = getattr(handler, meth_name)
300
301 result = func(*args)
302 if result is not None:
303 return result
result undefined, func = <bound method
HTTPDefaultErrorHandler.http_error...lt of
<urllib2.HTTPDefaultErrorHandler instance>>, args = (<urllib2.Request
instance>, <open file '<socket>', mode 'rb'>, 500, 'Internal Server
Error', <httplib.HTTPMessage instance>)
/usr/lib/python2.2/urllib2.py in
http_error_default(self=<urllib2.HTTPDefaultErrorHandler instance>,
req=<urllib2.Request instance>, fp=<open file '<socket>', mode 'rb'>,
code=500, msg='Internal Server Error', hdrs=<httplib.HTTPMessage
instance>)
398 class HTTPDefaultErrorHandler(BaseHandler):
399 def http_error_default(self, req, fp, code, msg, hdrs):
400 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
401
402 class HTTPRedirectHandler(BaseHandler):
global HTTPError = <class urllib2.HTTPError>, req = <urllib2.Request
instance>, req.get_full_url = <bound method Request.get_full_url of
<urllib2.Request instance>>, code = 500, msg = 'Internal Server
Error', hdrs = <httplib.HTTPMessage instance>, fp = <open file
'<socket>', mode 'rb'>
HTTPError: HTTP Error 500: Internal Server Error
_HTTPError__super_init = <bound method HTTPError.__init__ of
<HTTPError a...92 whose fp = <open file '<socket>', mode 'rb'>>>
__del__ = <bound method HTTPError.__del__ of <HTTPError at...92
whose fp = <open file '<socket>', mode 'rb'>>>
__doc__ = 'Raised when HTTP error occurs, but also acts like
non-error return'
__getitem__ = <bound method HTTPError.__getitem__ of
<HTTPErro...92 whose fp = <open file '<socket>', mode 'rb'>>>
__init__ = <bound method HTTPError.__init__ of <HTTPError a...92
whose fp = <open file '<socket>', mode 'rb'>>>
__module__ = 'urllib2'
__repr__ = <bound method HTTPError.__repr__ of <HTTPError a...92
whose fp = <open file '<socket>', mode 'rb'>>>
__str__ = <bound method HTTPError.__str__ of <HTTPError at...92
whose fp = <open file '<socket>', mode 'rb'>>>
close = <bound method HTTPError.close of <HTTPError at 1...92
whose fp = <open file '<socket>', mode 'rb'>>>
code = 500
filename = 'http://www.euromillions.us/scgi-bin/euro7.py'
fileno = <built-in method fileno of file object>
fp = <open file '<socket>', mode 'rb'>
geturl = <bound method HTTPError.geturl of <HTTPError at ...92
whose fp = <open file '<socket>', mode 'rb'>>>
hdrs = <httplib.HTTPMessage instance>
headers = <httplib.HTTPMessage instance>
info = <bound method HTTPError.info of <HTTPError at 13...92
whose fp = <open file '<socket>', mode 'rb'>>>
msg = 'Internal Server Error'
read = <built-in method read of file object>
readline = <built-in method readline of file object>
readlines = <built-in method readlines of file object>
url = 'http://www.euromillions.us/scgi-bin/euro7.py'
some way incorrect...or is there a problem with Python on my hoster's
site ??
The highlites don't seem to show here...but line #80 and line # 38 are
the first line offenders.
--> --> -->
HTTPError Python 2.2.2: /usr/bin/python
Fri Jun 4 13:58:00 2004
A problem occurred in a Python script. Here is the sequence of
function calls leading up to the error, in the order they occurred.
/home/euromill/public_html/scgi-bin/euro3.py
78 write_dig_err(ls)
79 x = x + 1
80 process_request(ls)
81
82
process_request = <function process_request>, ls =
['johnfdutchfrederic', ['77', '77', '77', '77', '77', '77', '77'],
'EuroMillions', '5', 'error']
/home/euromill/public_html/scgi-bin/euro3.py in
process_request(ls=['johnfdutchfrederic', ['77', '77', '77', '77',
'77', '77', '77'], 'EuroMillions', '5', 'error'])
36 req = urllib2.Request(url='http://www.euromillions.us/scgi-bin/euro8.py',
\
37 data = strdata)
38 f = urllib2.urlopen(req)
39 print "Content-type: text/html\n\n"
40 print f.read()
f undefined, global urllib2 = <module 'urllib2' from
'/usr/lib/python2.2/urllib2.pyc'>, urllib2.urlopen = <function
urlopen>, req = <urllib2.Request instance>
/usr/lib/python2.2/urllib2.py in urlopen(url=<urllib2.Request
instance>, data=None)
136 if _opener is None:
137 _opener = build_opener()
138 return _opener.open(url, data)
139
140 def install_opener(opener):
global _opener = <urllib2.OpenerDirector instance>, _opener.open =
<bound method OpenerDirector.open of <urllib2.OpenerDirector
instance>>, url = <urllib2.Request instance>, data = None
/usr/lib/python2.2/urllib2.py in open(self=<urllib2.OpenerDirector
instance>, fullurl=<urllib2.Request instance>, data=None)
320 type_ = req.get_type()
321 result = self._call_chain(self.handle_open, type_, type_
+ \
322 '_open', req)
323 if result:
324 return result
req = <urllib2.Request instance>
/usr/lib/python2.2/urllib2.py in
_call_chain(self=<urllib2.OpenerDirector instance>, chain={'do':
[<urllib2.HTTPHandler instance>, <urllib2.HTTPSHandler instance>],
'file': [<urllib2.FileHandler instance>], 'ftp': [<urllib2.FTPHandler
instance>], 'http': [<urllib2.HTTPHandler instance>], 'https':
[<urllib2.HTTPSHandler instance>], 'proxy': [<urllib2.ProxyHandler
instance>], 'unknown': [<urllib2.UnknownHandler instance>]},
kind='http', meth_name='http_open', *args=(<urllib2.Request
instance>,))
299 func = getattr(handler, meth_name)
300
301 result = func(*args)
302 if result is not None:
303 return result
result undefined, func = <bound method HTTPHandler.http_open of
<urllib2.HTTPHandler instance>>, args = (<urllib2.Request instance>,)
/usr/lib/python2.2/urllib2.py in http_open(self=<urllib2.HTTPHandler
instance>, req=<urllib2.Request instance>)
788
789 def http_open(self, req):
790 return self.do_open(httplib.HTTP, req)
791
792
self = <urllib2.HTTPHandler instance>, self.do_open = <bound method
HTTPHandler.do_open of <urllib2.HTTPHandler instance>>, global httplib
= <module 'httplib' from '/usr/lib/python2.2/httplib.pyc'>,
httplib.HTTP = <class httplib.HTTP>, req = <urllib2.Request instance>
/usr/lib/python2.2/urllib2.py in do_open(self=<urllib2.HTTPHandler
instance>, http_class=<class httplib.HTTP>, req=<urllib2.Request
instance>)
782 return addinfourl(fp, hdrs, req.get_full_url())
783 else:
784 return self.parent.error('http', req, fp, code, msg,
hdrs)
785
786
self = <urllib2.HTTPHandler instance>, self.parent =
<urllib2.OpenerDirector instance>, self.parent.error = <bound method
OpenerDirector.error of <urllib2.OpenerDirector instance>>, req =
<urllib2.Request instance>, fp = <open file '<socket>', mode 'rb'>,
code = 500, msg = 'Internal Server Error', hdrs = <httplib.HTTPMessage
instance>
/usr/lib/python2.2/urllib2.py in error(self=<urllib2.OpenerDirector
instance>, proto=500, *args=({301: [<urllib2.HTTPRedirectHandler
instance>], 302: [<urllib2.HTTPRedirectHandler instance>], 'default':
[<urllib2.HTTPDefaultErrorHandler instance>]}, 'default',
'http_error_default', <urllib2.Request instance>, <open file
'<socket>', mode 'rb'>, 500, 'Internal Server Error',
<httplib.HTTPMessage instance>))
346 if http_err:
347 args = (dict, 'default', 'http_error_default') +
orig_args
348 return self._call_chain(*args)
349
350 # XXX probably also want an abstract factory that knows things
like
self = <urllib2.OpenerDirector instance>, self._call_chain = <bound
method OpenerDirector._call_chain of <urllib2.OpenerDirector
instance>>, args = ({301: [<urllib2.HTTPRedirectHandler instance>],
302: [<urllib2.HTTPRedirectHandler instance>], 'default':
[<urllib2.HTTPDefaultErrorHandler instance>]}, 'default',
'http_error_default', <urllib2.Request instance>, <open file
'<socket>', mode 'rb'>, 500, 'Internal Server Error',
<httplib.HTTPMessage instance>)
/usr/lib/python2.2/urllib2.py in
_call_chain(self=<urllib2.OpenerDirector instance>, chain={301:
[<urllib2.HTTPRedirectHandler instance>], 302:
[<urllib2.HTTPRedirectHandler instance>], 'default':
[<urllib2.HTTPDefaultErrorHandler instance>]}, kind='default',
meth_name='http_error_default', *args=(<urllib2.Request instance>,
<open file '<socket>', mode 'rb'>, 500, 'Internal Server Error',
<httplib.HTTPMessage instance>))
299 func = getattr(handler, meth_name)
300
301 result = func(*args)
302 if result is not None:
303 return result
result undefined, func = <bound method
HTTPDefaultErrorHandler.http_error...lt of
<urllib2.HTTPDefaultErrorHandler instance>>, args = (<urllib2.Request
instance>, <open file '<socket>', mode 'rb'>, 500, 'Internal Server
Error', <httplib.HTTPMessage instance>)
/usr/lib/python2.2/urllib2.py in
http_error_default(self=<urllib2.HTTPDefaultErrorHandler instance>,
req=<urllib2.Request instance>, fp=<open file '<socket>', mode 'rb'>,
code=500, msg='Internal Server Error', hdrs=<httplib.HTTPMessage
instance>)
398 class HTTPDefaultErrorHandler(BaseHandler):
399 def http_error_default(self, req, fp, code, msg, hdrs):
400 raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
401
402 class HTTPRedirectHandler(BaseHandler):
global HTTPError = <class urllib2.HTTPError>, req = <urllib2.Request
instance>, req.get_full_url = <bound method Request.get_full_url of
<urllib2.Request instance>>, code = 500, msg = 'Internal Server
Error', hdrs = <httplib.HTTPMessage instance>, fp = <open file
'<socket>', mode 'rb'>
HTTPError: HTTP Error 500: Internal Server Error
_HTTPError__super_init = <bound method HTTPError.__init__ of
<HTTPError a...92 whose fp = <open file '<socket>', mode 'rb'>>>
__del__ = <bound method HTTPError.__del__ of <HTTPError at...92
whose fp = <open file '<socket>', mode 'rb'>>>
__doc__ = 'Raised when HTTP error occurs, but also acts like
non-error return'
__getitem__ = <bound method HTTPError.__getitem__ of
<HTTPErro...92 whose fp = <open file '<socket>', mode 'rb'>>>
__init__ = <bound method HTTPError.__init__ of <HTTPError a...92
whose fp = <open file '<socket>', mode 'rb'>>>
__module__ = 'urllib2'
__repr__ = <bound method HTTPError.__repr__ of <HTTPError a...92
whose fp = <open file '<socket>', mode 'rb'>>>
__str__ = <bound method HTTPError.__str__ of <HTTPError at...92
whose fp = <open file '<socket>', mode 'rb'>>>
close = <bound method HTTPError.close of <HTTPError at 1...92
whose fp = <open file '<socket>', mode 'rb'>>>
code = 500
filename = 'http://www.euromillions.us/scgi-bin/euro7.py'
fileno = <built-in method fileno of file object>
fp = <open file '<socket>', mode 'rb'>
geturl = <bound method HTTPError.geturl of <HTTPError at ...92
whose fp = <open file '<socket>', mode 'rb'>>>
hdrs = <httplib.HTTPMessage instance>
headers = <httplib.HTTPMessage instance>
info = <bound method HTTPError.info of <HTTPError at 13...92
whose fp = <open file '<socket>', mode 'rb'>>>
msg = 'Internal Server Error'
read = <built-in method read of file object>
readline = <built-in method readline of file object>
readlines = <built-in method readlines of file object>
url = 'http://www.euromillions.us/scgi-bin/euro7.py'