Message75298
It seems to depend on working directory:
exarkun@charm:/tmp$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/home/exarkun/foobar.zip')
>>> import foobar, inspect
>>> inspect.getsource(foobar.foo)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/inspect.py", line 629, in getsource
lines, lnum = getsourcelines(object)
File "/usr/lib/python2.5/inspect.py", line 618, in getsourcelines
lines, lnum = findsource(object)
File "/usr/lib/python2.5/inspect.py", line 468, in findsource
raise IOError('could not get source code')
IOError: could not get source code
>>>
versus:
exarkun@charm:~$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/home/exarkun/foobar.zip')
>>> import foobar, inspect
>>> inspect.getsource(foobar.foo)
'def foo():\n pass\n'
>>> |
|
Date |
User |
Action |
Args |
2008-10-28 17:51:24 | exarkun | set | recipients:
+ exarkun, gpolo |
2008-10-28 17:51:24 | exarkun | set | messageid: <1225216284.95.0.159490916659.issue4223@psf.upfronthosting.co.za> |
2008-10-28 17:51:24 | exarkun | link | issue4223 messages |
2008-10-28 17:51:23 | exarkun | create | |
|