[issue4223] inspect.getsource doesn't work on functions imported from a zipfile

Guilherme Polo report at bugs.python.org
Tue Oct 28 18:43:55 CET 2008


Guilherme Polo <ggpolo at gmail.com> added the comment:

Well anyway, some sample code:

import zipfile

z = zipfile.ZipFile('aaa.zip', mode='w')
z.writestr('aa.py', 'def x(): print "hi there"\n\ndef y(): print "hi"')
z.close()


and then:


import sys
import inspect

sys.path.append('aaa.zip')
import aa

inspect.getsource(aa.x)
inspect.getsource(aa.y)


Doesn't that work for you ?

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4223>
_______________________________________


More information about the Python-bugs-list mailing list