determining file type
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Wed Jun 14 07:21:58 EDT 2006
In <1150281704.342529.206640 at u72g2000cwu.googlegroups.com>, Ritesh Raj
Sarraf wrote:
> Also,
> f = file ('some_file.jpg')
>
> throws an error.
> "str object is not callable"
This happens if you rebind names of builtins. In this case to a string.
Don't do that!
In [5]:file
Out[5]:<type 'file'>
In [6]:file = 'foo.txt'
In [7]:file
Out[7]:'foo.txt'
In [8]:file('x')
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most recent call last)
/home/bj/<ipython console>
TypeError: 'str' object is not callable
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list