strange test for None
karoly.kiripolszky
karoly.kiripolszky at gmail.com
Sat Feb 3 12:34:59 EST 2007
More information about the Python-list mailing list
Sat Feb 3 12:34:59 EST 2007
- Previous message (by thread): strange test for None
- Next message (by thread): urllib2 hangs "forever" where there is no network interface
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
the tested variable was really a string containing "None" instead of simply None. this is the first time i ran into this error message confusion. :) thanks for the help! On Feb 3, 6:29 pm, Michael Bentley <rmc... at gmail.com> wrote: > On Feb 3, 2007, at 7:47 AM, karoly.kiripolszky wrote: > > > in my server i use the following piece of code: > > > ims = self.headers["if-modified-since"] > > if ims != None: > > t = int(ims) > > > and i'm always getting the following error: > > > t = int(ims) > > ValueError: invalid literal for int(): None > > > i wanna know what the hell is going on... first i tried to test using > > is not None, but it makes no difference. > > Sounds like ims == 'None'. Try changing: > > if ims != None: > > to > > if ims: > > and you might also wrap your call to int(ims) in a try block. > > HTH, > Michael
- Previous message (by thread): strange test for None
- Next message (by thread): urllib2 hangs "forever" where there is no network interface
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list