Re: HTTP GET Explodes...



John Machin wrote:
Pete wrote:
Fade in to episode II...

...
This is compiling a *constant* regular expression, and works OK on the
Windows distribution of Python 2.4.3 :

Hmmmm. Here's the version information stuff:

Python 2.4.2 (#1, Feb 12 2006, 03:59:46)
[GCC 4.1.0 20060210 (Red Hat 4.1.0-0.24)] on linux2

I'm going to upgrade Python and see if that has any effect...
I'm running this on a Fedora Core 5 box...

...
You appear to be running 2.4.n; what is n, and exactly which *x
platform are you running it on? Perhaps a file in /usr/lib/python2.4 is
corrupt, but we won't know until you give the *full* traceback. Do you
get the same results when you try what I did at the interpreter
interactive prompt?

The error I received was from the interactive prompt thing.

So I noticed from your first posting. Now do what you were asked: try
what I did.

Is there
some way I can get more verbose information or something that would be
more helpful?


Yes, just include the whole traceback!!! Example of what I mean is
below:

Here's my full interactive I/O:

Python 2.4.3 (#1, Jun 13 2006, 11:46:08)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import httplib
conn = httplib.HTTPConnection("www.python.org")
conn.request("GET", "/index.html")
Hello World.
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/httplib.py", line 804, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.4/httplib.py", line 821, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib/python2.4/httplib.py", line 752, in putrequest
self.putheader('Host', self.host.encode("idna"))
File "/usr/lib/python2.4/encodings/__init__.py", line 96, in
search_function
globals(), locals(), _import_tail)
File "/usr/lib/python2.4/encodings/idna.py", line 6, in ?
dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]")
File "/usr/lib/python2.4/sre.py", line 180, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.4/sre.py", line 225, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python2.4/sre_compile.py", line 500, in compile
code = _code(p, flags)
File "/usr/lib/python2.4/sre_compile.py", line 481, in _code
_compile_info(code, p, flags)
File "/usr/lib/python2.4/sre_compile.py", line 459, in _compile_info
_compile_charset(charset, flags, code)
File "/usr/lib/python2.4/sre_compile.py", line 178, in
_compile_charset
for op, av in _optimize_charset(charset, fixup):
File "/usr/lib/python2.4/sre_compile.py", line 221, in
_optimize_charset
return _optimize_unicode(charset, fixup)
File "/usr/lib/python2.4/sre_compile.py", line 341, in
_optimize_unicode
mapping = array.array('b', mapping).tostring()
TypeError: typecode argument must be a valid type.



| C:\junk>copy con wally.py
| guff = 1 / 0
| ^Z
| 1 file(s) copied.
|
| C:\junk>python
| Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
on win32
| Type "help", "copyright", "credits" or "license" for more
information.
| >>> import wally
| Traceback (most recent call last):
| File "<stdin>", line 1, in ?

Your posting appeared truncated when viewed with both Google groups and
in a regular newsreader.

I clipped out stuff that didn't seem relevant. I didn't clip anything
out this time.

There is no guarantee that the last line shown is the one that caused
the error.
Just as if this example were missing the following lines, we don't know
which
source line caused the error, nor even what the error was!!

| File "wally.py", line 1, in ?
| guff = 1 / 0
| ZeroDivisionError: integer division or modulo by zero

HTH,
John

I'm still lost... Were you able to successfully run the GET example at
http://www.python.org/doc/current/lib/httplib-examples.html ?

Thanks for your help!
Pete

.



Relevant Pages

  • Re: HTTP GET Explodes...
    ... This is compiling a *constant* regular expression, ... I'm going to upgrade Python and see if that has any effect... ... but we won't know until you give the *full* traceback. ... So I noticed from your first posting. ...
    (comp.lang.python)
  • Re: HTTP GET Explodes...
    ... I'm going to upgrade Python and see if that has any effect... ... but we won't know until you give the *full* traceback. ... return _compile(pattern, flags) ... typecode argument must be a valid type. ...
    (comp.lang.python)
  • Is it bug or feature in sre?
    ... I've accidentally tried on of my programs written for Python 1.5 ... Traceback: ... return _compile(pattern, flags) ... raise error, v # invalid expression ...
    (comp.lang.python)
  • Re: Text Suffix to Prefix Conversion
    ... then you should "compile" the regular expression so that python ... return _compile(pattern, flags) ...
    (comp.lang.python)
  • Re: [perl-python] Python documentation moronicities (continued)
    ... > Compile a regular expression pattern into a regular expression object, ... > The expression's behaviour can be modified by specifying a flags ...
    (comp.lang.python)