OKay, but how do I check (and possibly change) _proxy environment
variables in python? I know in perl its somewhere along the lines of
$ENV{'env_name'}, is it the same in python?
Thanks again
Cheers
Fredrik Lundh wrote:
Astan Chee wrote:
I have a python script which runs perfectly on my machine.
However a machine that I tested it on gives the following error
message:
Traceback (most recent call last):
File "whip.py", line 616, in OnRebootRunning
File "whip.py", line 626, in RebootCustom
File "urllib.pyc", line 77, in urlopen
File "urllib.pyc", line 170, in open
TypeError: cannot concatenate 'str' and 'NoneType' objects
The code snipplet where this error
happens is
f = urllib.urlopen("http://www.hotmail.com/)
notes= f.readlines()
Does anyone know what causes this error? Im perplexed because it works
on some machines and it doesnt work on other computers although they all
have the same spec.
assuming you're using Python 2.4, the relevant portion of urllib.py
looks like this:
urltype, url = ""
if not urltype:
urltype = 'file'
if urltype in self.proxies:
proxy = self.proxies[urltype]
urltype, proxyhost = splittype(proxy)
host, selector = splithost(proxyhost)
url = "" fullurl) # Signal special case to open_*()
else:
proxy = None
name = 'open_' + urltype # <-- this is line 170
the error message indicates that urltype is None when you get to
line 170, and the only way it can get set to None is a bogus proxy
setting (causing splittype to fail).
checking the environment for things that end with "_proxy" should
help.
</F>
|
--
http://mail.python.org/mailman/listinfo/python-list