Insane crazy question - printing commands
Guilherme Polo
ggpolo at gmail.com
Tue Nov 6 12:44:28 EST 2007
2007/11/6, Donn <donn.ingle at gmail.com>:
> > import inspect
> >
> > class Box:
> > def draw(self):
> > print "hi"
> > return 3
> >
> > x = Box()
> > print inspect.getsource(x.draw)
>
> Tried that, but get this error. I did a dir(inspect) in the command env. and
> getsource it definitely there...
>
> Traceback (most recent call last):
> File "inspect.py", line 1, in ?
> import inspect
>
> File "/home/donn/Projects/pythoning/fontyPython/extending/cairotests/containers/inspect.py",
> line 9, in ?
> print inspect.getsource(x.draw)
> AttributeError: 'module' object has no attribute 'getsource'
>
By now you should know that you shouldn't be naming your modules like
that. Rename your inspect.py to something else
--
-- Guilherme H. Polo Goncalves
More information about the Python-list
mailing list