From: Astan C. <st...@al...> - 2005-09-14 06:34:11
|
Hi Guys, I have a python script which runs perfectly on my machine and when I compile and create an executeable it runs fine too. 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 (OnRebootRunning function) where this error happens is f = urllib.urlopen("http://www.hotmail.com/") notes= f.readlines() Note that the executeable fails with this error, i've treid reinstalling python and the like but none seem to help. 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. Thanks for the help Cheers Stan |
From: Astan C. <st...@al...> - 2005-09-14 20:23:21
|
Well, everything is the same for all the CPUs, they have exactly the same software installed and lie on the same router to the internet. hotmail.com is reachable by all, but Im just curious as what causes "TypeError: cannot concatenate 'str' and 'NoneType' objects" type error. Thanks for you help Cheers Harald Armin Massa wrote: > Astan, > > maybe > > www.hotmail.com <http://www.hotmail.com> is unreachable from the other > machine? > > so that somewhere inbetween there is A none > > Harald > > 2005/9/14, Astan Chee <st...@al... <mailto:st...@al...>>: > > Hi Guys, > I have a python script which runs perfectly on my machine and when I > compile and create an executeable it runs fine too. > 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 (OnRebootRunning function) where this error > happens is > f = urllib.urlopen("http://www.hotmail.com/ > <http://www.hotmail.com/>") > notes= f.readlines() > > Note that the executeable fails with this error, i've treid > reinstalling > python and the like but none seem to help. 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. > Thanks for the help > Cheers > Stan > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download it for free - -and be entered to win a 42" plasma tv or > your very > own Sony(tm)PSP. Click here to play: > http://sourceforge.net/geronimo.php > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > <mailto:Py2...@li...> > https://lists.sourceforge.net/lists/listinfo/py2exe-users > <https://lists.sourceforge.net/lists/listinfo/py2exe-users> > > > > > -- > GHUM Harald Massa > persuasion python postgresql > Harald Armin Massa > Reinsburgstraße 202b > 70197 Stuttgart > 0173/9409607 |
From: John M. <sjm...@le...> - 2005-09-14 21:34:21
|
Astan Chee wrote: > Well, everything is the same for all the CPUs, they have exactly the > same software installed and lie on the same router to the internet. > hotmail.com is reachable by all, but Im just curious as what causes > "TypeError: cannot concatenate 'str' and 'NoneType' objects" type error. > Thanks for you help > Cheers > 1. You haven't stated whether this problem occurs *without* py2exe on the problematical box. In other words, have you established that py2exe makes a difference? 2. Have you looked at the source code i.e urllib.py?? My reading suggests that on the machine which causes the problem, the proxy/proxies for http is/are messed up, causing a method to return None instead of "http". By "messed up", I mean the proxy should start with "http" (e.g. "http://123.77.66.55") but it doesn't. The method that processes proxies would return None in that case. HTH, John > Harald Armin Massa wrote: > >> Astan, >> >> maybe >> >> www.hotmail.com <http://www.hotmail.com> is unreachable from the >> other machine? >> >> so that somewhere inbetween there is A none >> >> Harald >> >> 2005/9/14, Astan Chee <st...@al... <mailto:st...@al...>>: >> >> Hi Guys, >> I have a python script which runs perfectly on my machine and when I >> compile and create an executeable it runs fine too. >> 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 (OnRebootRunning function) where this error >> happens is >> f = urllib.urlopen("http://www.hotmail.com/ >> <http://www.hotmail.com/>") >> notes= f.readlines() >> >> Note that the executeable fails with this error, i've treid >> reinstalling >> python and the like but none seem to help. 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. >> Thanks for the help >> Cheers >> Stan >> |
From: Astan C. <st...@al...> - 2005-09-14 21:42:05
|
Hmmm, okay, I tried to put in an address of a local intranet with http and it still doesnt work. Do I need to specify proxies for an intranet address? I tried investigating fullurl and splittype(fullurl) and it seems that all it is doing is spliting the http and the address. And Im using py2exe because as Im aware of, py2exe allows me to run executeables in python without python installed. Because I've tried with python installed and it still gave the same problem (thus I was trying to isolate the problem by not using python....am I on the wrong track here?) I'll check out the settings of the problematic machine. Thanks for yuor help John Machin wrote: > Astan Chee wrote: > >> Well, everything is the same for all the CPUs, they have exactly the >> same software installed and lie on the same router to the internet. >> hotmail.com is reachable by all, but Im just curious as what causes >> "TypeError: cannot concatenate 'str' and 'NoneType' objects" type error. >> Thanks for you help >> Cheers >> > 1. You haven't stated whether this problem occurs *without* py2exe on > the problematical box. In other words, have you established that > py2exe makes a difference? > > 2. Have you looked at the source code i.e urllib.py?? My reading > suggests that on the machine which causes the problem, the > proxy/proxies for http is/are messed up, causing a method to return > None instead of "http". By "messed up", I mean the proxy should start > with "http" (e.g. "http://123.77.66.55") but it doesn't. The method > that processes proxies would return None in that case. > > HTH, > John > >> Harald Armin Massa wrote: >> >>> Astan, >>> >>> maybe >>> >>> www.hotmail.com <http://www.hotmail.com> is unreachable from the >>> other machine? >>> >>> so that somewhere inbetween there is A none >>> >>> Harald >>> >>> 2005/9/14, Astan Chee <st...@al... <mailto:st...@al...>>: >>> >>> Hi Guys, >>> I have a python script which runs perfectly on my machine and >>> when I >>> compile and create an executeable it runs fine too. >>> 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 (OnRebootRunning function) where this error >>> happens is >>> f = urllib.urlopen("http://www.hotmail.com/ >>> <http://www.hotmail.com/>") >>> notes= f.readlines() >>> >>> Note that the executeable fails with this error, i've treid >>> reinstalling >>> python and the like but none seem to help. 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. >>> Thanks for the help >>> Cheers >>> Stan >>> > > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download it for free - -and be entered to win a 42" plasma tv or your > very > own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > https://lists.sourceforge.net/lists/listinfo/py2exe-users > |
From: John M. <sjm...@le...> - 2005-09-14 22:00:28
|
Astan Chee wrote: > Hmmm, okay, I tried to put in an address of a local intranet with http > and it still doesnt work. > Do I need to specify proxies for an intranet address? Whether you *need* to or not is probably irrelevant. My reading of the code is that a proxy *is* specified and it is stuffed. > I tried investigating fullurl and splittype(fullurl) and it seems that > all it is doing is spliting the http and the address. All is not always what it seems. I suggest you take a copy of urllib.py, rename it and add some print statements so you can track down why urltype refers to None instead of "http". > And Im using py2exe because as Im aware of, py2exe allows me to run > executeables in python without python installed. Because I've tried > with python installed and it still gave the same problem (thus I was > trying to isolate the problem by not using python....am I on the wrong > track here?) Very much so. Three strikes: (1) py2exe should provide all that's relevant from Python, so you aren't doing much isolation of any kind and certainly no worthwhile isolation. (2) The py2exe list is for problems where Python scripts work when run by Python but don't seem to work when frozen with py2exe. (3) In the case of a problem that occurs when run under Python, take your problem to python-list -- there's a much wider audience there, meaning usually faster problem resolution. > I'll check out the settings of the problematic machine. > Thanks for yuor help > |
From: Jim V. <Jim...@no...> - 2005-09-14 20:49:58
|
With the caveat that I know nothing about your problem and have never= =20 used urllib, here is the relevant code in urllib.py: <code> def open(self, fullurl, data=3DNone): """Use URLopener().open(file) instead of open(file, 'r').""" fullurl =3D unwrap(toBytes(fullurl)) if self.tempcache and fullurl in self.tempcache: filename, headers =3D self.tempcache[fullurl] fp =3D open(filename, 'rb') return addinfourl(fp, headers, fullurl) urltype, url =3D splittype(fullurl) if not urltype: urltype =3D 'file' if urltype in self.proxies: proxy =3D self.proxies[urltype] urltype, proxyhost =3D splittype(proxy) host, selector =3D splithost(proxyhost) url =3D (host, fullurl) # Signal special case to open_*() else: proxy =3D None name =3D 'open_' + urltype ... </code> So if the behavior is repeatable (with apologies for stating the=20 obvious), why not investigate what "fullurl" is such that urltype, proxyhost =3D splittype(proxy) evaluates to urltype=3DNone which appears to be the source of the err= or? -- jv Astan Chee wrote: > Well, everything is the same for all the CPUs, they have exactly th= e=20 > same software installed and lie on the same router to the internet.= =20 > hotmail.com is reachable by all, but Im just curious as what causes= =20 > "TypeError: cannot concatenate 'str' and 'NoneType' objects" type e= rror. > Thanks for you help > Cheers > > Harald Armin Massa wrote: > >> Astan, >> >> maybe >> >> www.hotmail.com <http://www.hotmail.com> is unreachable from the= =20 >> other machine? >> >> so that somewhere inbetween there is A none >> >> Harald >> >> 2005/9/14, Astan Chee <st...@al... <mailto:st...@al...>>: >> >> Hi Guys, >> I have a python script which runs perfectly on my machine and = when I >> compile and create an executeable it runs fine too. >> However a machine that I tested it on gives the following erro= r >> 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 (OnRebootRunning function) where this error >> happens is >> f =3D urllib.urlopen("http://www.hotmail.com/ >> <http://www.hotmail.com/>") >> notes=3D f.readlines() >> >> Note that the executeable fails with this error, i've treid >> reinstalling >> python and the like but none seem to help. Does anyone know wh= at >> 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. >> Thanks for the help >> Cheers >> Stan >> >> >> ------------------------------------------------------- >> SF.Net email is sponsored by: >> Tame your development challenges with Apache's Geronimo App Se= rver. >> Download it for free - -and be entered to win a 42" plasma tv = or >> your very >> own Sony(tm)PSP. Click here to play: >> http://sourceforge.net/geronimo.php >> _______________________________________________ >> Py2exe-users mailing list >> Py2...@li... >> <mailto:Py2...@li...> >> https://lists.sourceforge.net/lists/listinfo/py2exe-users >> <https://lists.sourceforge.net/lists/listinfo/py2exe-users> >> >> >> >> >> --=20 >> GHUM Harald Massa >> persuasion python postgresql >> Harald Armin Massa >> Reinsburgstra=DFe 202b >> 70197 Stuttgart >> 0173/9409607=20 > |