473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HTTP GET Explodes...

I was running the HTTP GET example at
http://www.python.org/doc/current/li...-examples.html and ran
into a bit of trouble...
>>import httplib # This works.
conn = httplib.HTTPConnection("www.python.org") # This works.
conn.request("GET", "/index.html") # This does not work...
The errors I get are below. Any suggestions on how to get rid of the
errors? Thanks!

# Begin errors...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/httplib.py", line 801, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.4/httplib.py", line 818, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib/python2.4/httplib.py", line 749, 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()

Sep 24 '06 #1
11 2315

Pete wrote:
I was running the HTTP GET example at
http://www.python.org/doc/current/li...-examples.html and ran
into a bit of trouble...
>import httplib # This works.
conn = httplib.HTTPConnection("www.python.org") # This works.
conn.request("GET", "/index.html") # This does not work...

The errors I get are below. Any suggestions on how to get rid of the
errors? Thanks!
You have *ONE* error, with a long traceback, which is incomplete,
because it doesn't show the error message that should be at the end of
the traceback.
>
# Begin errors...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/httplib.py", line 801, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python2.4/httplib.py", line 818, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib/python2.4/httplib.py", line 749, 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]")
This is compiling a *constant* regular expression, and works OK on the
Windows distribution of Python 2.4.3 :

| 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 re
| >>dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]")
| >>dots.match('.')
| <_sre.SRE_Match object at 0x00AF6058# bonus: compiled regex works.
| >>dots.match(u'\uff61')
| <_sre.SRE_Match object at 0x00AF6918>

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?
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()
.... to be continued in the next episode.

Regards,
John

Sep 24 '06 #2
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. Is there
some way I can get more verbose information or something that would be
more helpful?

Thanks,
Pete

Sep 24 '06 #3
...
I'm going to upgrade Python and see if that has any effect...
...
I upgraded Python, it had an effect, but not a positive one. My
interactivity is below. Where is the "Hello World." text coming from?

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.
>>>
Sep 24 '06 #4

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:

| 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.
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

Sep 24 '06 #5
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/li...-examples.html ?

Thanks for your help!
Pete

Sep 24 '06 #6

Pete wrote:
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/li...-examples.html ?
Yes., but irrelevant -- I was also able (as demonstrated) to do the
re.compile(constant) thing that was part-way down the traceback.

Moving right along:
1. The Hello World thing is really worrying.
2. The error message "typecode argument must be a valid type" doesn't
occur *anywhere* in the 2.4.3 source AFAICT. The string "typecode"
appears in only 2 modules, array and some Mac gadget. 'b' is a valid
typecode. The expected error message for invalid typecodes is:
Modules\arraymodule.c(1874): "bad typecode (must be c, b, B, u, h, H,
i, I, l, L, f or d)");

I checked in the Python subversion/cvs repository: it looked like that
(maybe fewer valid typecodes) back in the year 2000. It still looks
like that (latest revision: 24 August).

Conclusion: Your Python installation is well and truly stuffed. You
need advice from someone who knows how Python is set up for and
installed on your platform.

Good luck!
John

Sep 24 '06 #7
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.

Off-hand -- I'd suggest you do a search of your computer for any
occurrence of
httplib.py
httplib.pyc
httplib.pyo
on the odd chance that you are picking up some corrupted version...
Problem solved (sort of...). I searched for "httplib*". I had some
cygwin stuff archived on my Linux box, but the cygwin stuff wasn't in
my search path, but on an odd chance I renamed the cygwin httplib*
files to something else. Problem persisted. On another odd chance I
fired up "python" as root, plugged in the example at
http://www.python.org/doc/current/li...-examples.html, and things
were clicking... There was a problem with "r2", but that was
understandable...

In my confused state I created a new user, fired up python, slung the
example code, and had no problem (except for "r2", but that was
understandable).

So, I looked at my search path under the account that was experiencing
the problem. That wasn't it... Then I'm thinking there's an
environmental variable causing this. Too many to work right now. Will
investigate later.

So, the problem lies somewhere in the account running Python... Not
sure how/why...

Thanks to all!,
Pete
>
-=-=-=-=-=-=-=-
PythonWin 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32.
Portions Copyright 1994-2004 Mark Hammond (mh******@skippinet.com.au) -
see 'Help/About PythonWin' for further copyright information.
>import httplib
conn = httplib.HTTPConnection("www.python.org")
conn.request("GET", "/index.html")
resp = conn.getresponse()
print resp.getheaders()
[('content-length', '12196'), ('accept-ranges', 'bytes'), ('server',
'Apache/2.0.54 (Debian GNU/Linux) DAV/2 SVN/1.1.4 mod_python/3.1.3
Python/2.3.5 mod_ssl/2.0.54 OpenSSL/0.9.7e'), ('last-modified', 'Sat, 23
Sep 2006 23:49:01 GMT'), ('etag', '"61b82-2fa4-99e01540"'), ('date',
'Sun, 24 Sep 2006 03:26:30 GMT'), ('content-type', 'text/html')]
>print resp.read()
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
--
Wulfraed Dennis Lee Bieber KD6MOG
wl*****@ix.netcom.com wu******@bestiaria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: we******@bestiaria.com)
HTTP://www.bestiaria.com/
Sep 24 '06 #8
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.

Off-hand -- I'd suggest you do a search of your computer for any
occurrence of
httplib.py
httplib.pyc
httplib.pyo
on the odd chance that you are picking up some corrupted version...
Problem solved (sort of...). I searched for "httplib*". I had some
cygwin stuff archived on my Linux box, but the cygwin stuff wasn't in
my search path, but on an odd chance I renamed the cygwin httplib*
files to something else. Problem persisted. On another odd chance I
fired up "python" as root, plugged in the example at
http://www.python.org/doc/current/li...-examples.html, and things
were clicking... There was a problem with "r2", but that was
understandable...

In my confused state I created a new user, fired up python, slung the
example code, and had no problem (except for "r2", but that was
understandable).

So, I looked at my search path under the account that was experiencing
the problem. That wasn't it... Then I'm thinking there's an
environmental variable causing this. Too many to work right now. Will
investigate later.

So, the problem lies somewhere in the account running Python... Not
sure how/why...

Thanks to all!,
Pete
>
-=-=-=-=-=-=-=-
PythonWin 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32.
Portions Copyright 1994-2004 Mark Hammond (mh******@skippinet.com.au) -
see 'Help/About PythonWin' for further copyright information.
>import httplib
conn = httplib.HTTPConnection("www.python.org")
conn.request("GET", "/index.html")
resp = conn.getresponse()
print resp.getheaders()
[('content-length', '12196'), ('accept-ranges', 'bytes'), ('server',
'Apache/2.0.54 (Debian GNU/Linux) DAV/2 SVN/1.1.4 mod_python/3.1.3
Python/2.3.5 mod_ssl/2.0.54 OpenSSL/0.9.7e'), ('last-modified', 'Sat, 23
Sep 2006 23:49:01 GMT'), ('etag', '"61b82-2fa4-99e01540"'), ('date',
'Sun, 24 Sep 2006 03:26:30 GMT'), ('content-type', 'text/html')]
>print resp.read()
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
--
Wulfraed Dennis Lee Bieber KD6MOG
wl*****@ix.netcom.com wu******@bestiaria.com
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: we******@bestiaria.com)
HTTP://www.bestiaria.com/
Sep 24 '06 #9

Pete wrote:
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.
Off-hand -- I'd suggest you do a search of your computer for any
occurrence of
httplib.py
httplib.pyc
httplib.pyo
on the odd chance that you are picking up some corrupted version...
Don't search; just open the lid and read the label that's tied around
the culprit's neck; example:

| >>import httplib
| >>httplib.__file__
| 'c:\\python24\\lib\\httplib.pyc'

If you want to see where it finds *everything* that's imported, run
Python with the -v arg.
If you want to see where it looks for each module imported, use -vv
(that's vee vee, not dubya).

HTH,
John

HTH,
John

Sep 24 '06 #10
Pete wrote:
So, I looked at my search path under the account that was experiencing
the problem. That wasn't it... Then I'm thinking there's an
environmental variable causing this. Too many to work right now. Will
investigate later.
You can see all environment variables with the declare command:

$ declare
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
....
XTERM_SHELL=/bin/bash
XTERM_VERSION='XTerm(220)'
_=declare

Regards,
Jordan

Sep 24 '06 #11
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.
>
Off-hand -- I'd suggest you do a search of your computer for any
occurrence of
httplib.py
httplib.pyc
httplib.pyo
on the odd chance that you are picking up some corrupted version...

Don't search; just open the lid and read the label that's tied around
the culprit's neck; example:

| >>import httplib
| >>httplib.__file__
| 'c:\\python24\\lib\\httplib.pyc'

If you want to see where it finds *everything* that's imported, run
Python with the -v arg.
If you want to see where it looks for each module imported, use -vv
(that's vee vee, not dubya).

HTH,
John

HTH,
John
Thanks to all for your assistance. Not sure what the problem was, but
the problem no longer exists. In an attempt to track down the
environmental variables I rebooted the system a few times and the
example code I was working with does indeed work on my system.

After upgrading python I exited my interactive session and jumped back
in to an interactive session which displayed the new python version
number. Experienced problems. Now, no problems. Not sure what made the
problem(s) go away... Very odd...
--
Pete

Sep 24 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Wolfgang May | last post by:
Hi, I have a problem with the HTTP implementation of the PEAR package: I try to PUT an XML instance to an XML database (eXist), but it always puts a binary: <?php require_once...
8
by: ben | last post by:
I'm trying to write a web client script in python to log onto a web page and pull some information off of it. The page has quite a few behind the scenes http things going on that are making it...
7
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
0
by: jacob c. | last post by:
When I request a URL using urllib2, it appears that urllib2 always makes the request using HTTP 1.0, and not HTTP 1.1. I'm trying to use the "If-None-Match"/"ETag" HTTP headers to conserve...
8
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
17
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call...
5
by: designsimply | last post by:
I am trying to http post some xml to to a remote server using php. When I try to submit xml using PEAR's HTTP_Client::post() to the remote server, I get back the following "Invalid Document Format"...
24
by: sinister | last post by:
After doing a websearch, it appears that it's OK to omit the "http:" to form a relative URL. Are there any pitfalls to this? For example, if there is a page http://www.domain1.com/page1.html...
4
by: Adam | last post by:
Hi all, OK, I'm baffled. I have a menu in a table which I've just realized is "breaking apart" in Safari: http://www.fitcityforwomen.com/00-intro/index.html Yet when I plunk the menu by...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.