[Tutor] Type() Getting Type Error

Evert Rol evert.rol at gmail.com
Fri Nov 9 16:10:35 CET 2007


On 9 Nov 2007, at 14:48 , Chernev Chernev wrote:

> I'm debugging a script and want to check the type of an object.
>
> So in the script I write:
> print type([object]
>
> This bombs, and I get
> "TypeError: 'str' object is not callable'
>
> I've also tried
> x = type([object])
> print x
>
> Same thing.

Works fine for me for both cases. What version of Python are you  
running? Both 2.5 and 2.3 seem to work for me (on Mac OS X).

Is there anything else in your script that can cause this error?


>
> In the interactive, 'type([object])' works fine.
>
> What am I missing here?
>


More information about the Tutor mailing list