<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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?<br>
Thanks again<br>
Cheers<br>
<br>
Fredrik Lundh wrote:
<blockquote cite="middgbcbj$3ju$1@sea.gmane.org" type="cite">
<pre wrap="">Astan Chee wrote:
</pre>
<blockquote type="cite">
<pre wrap=""> 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("<a class="moz-txt-link-freetext" href="http://www.hotmail.com/">http://www.hotmail.com/</a>)
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.
</pre>
</blockquote>
<pre wrap=""><!---->
assuming you're using Python 2.4, the relevant portion of urllib.py
looks like this:
urltype, url = splittype(fullurl)
if not urltype:
urltype = 'file'
if urltype in self.proxies:
proxy = self.proxies[urltype]
urltype, proxyhost = splittype(proxy)
host, selector = splithost(proxyhost)
url = (host, 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>
</pre>
</blockquote>
</body>
</html>