Re: type error on porting outfile.write
- From: Eric McCoy <ctr2sprt@xxxxxxxxxxx>
- Date: Tue, 20 Dec 2005 22:11:01 -0500
pmiller@xxxxxxx wrote:
> I ported my code from the development to
> application platform, I found a "type error"
> on a fileout statement:
> outfile.write(object.id +",")
What is the type of object.id? I'm guessing an integer. The exception
should tell you, e.g.:
TypeError: unsupported operand type(s) for +: 'int' and 'str'
If I'm right, you can do this:
outfile.write("%d," % (object.id))
Though probably the better solution is to find out what code is
assigning an unexpected value to object.id.
.
- Follow-Ups:
- Re: type error on porting outfile.write
- From: Dave Hansen
- Re: type error on porting outfile.write
- References:
- type error on porting outfile.write
- From: pmiller
- type error on porting outfile.write
- Prev by Date: Re: Which Python web framework is most like Ruby on Rails?
- Next by Date: Subclassing socket
- Previous by thread: type error on porting outfile.write
- Next by thread: Re: type error on porting outfile.write
- Index(es):
Relevant Pages
|