Re: type error on porting outfile.write



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.

.



Relevant Pages

  • type error on porting outfile.write
    ... application platform, I found a "type error" ... on a fileout statement: ... Object.id is provided by a library routine ...
    (comp.lang.python)
  • type error on porting outfile.write
    ... application platform, I found a "type error" ... on a fileout statement: ... Object.id is provided by a library routine ...
    (comp.lang.python)
  • April 1
    ... Why does Friday, April 1, 2005 in a date formated cell generate a wrong data ... type error when using the WEEKDAY formula? ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)
  • Re: :test #something-specific
    ... the type error earlier and a bug if you want this call to be more ... forgiving. ... Prev by Date: ...
    (comp.lang.lisp)
  • Re: [9fans] MS Research reinvents Inferno?
    ... And you can't bind '#p' onto /dev because you'll get ... a type error. ... Russ ... Prev by Date: ...
    (comp.os.plan9)