This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author exarkun
Recipients belopolsky, exarkun, gpolo, loewis
Date 2008-10-28.21:59:38
SpamBayes Score 4.4730564e-10
Marked as misclassified No
Message-id <1225231180.3.0.306670127153.issue4223@psf.upfronthosting.co.za>
In-reply-to
Content
Here is a transcript for a complete, self-contained, minimal reproduction:

exarkun@charm:~$ cd /tmp
exarkun@charm:/tmp$ mkdir zipimportbugexample
exarkun@charm:/tmp$ cd zipimportbugexample/
exarkun@charm:/tmp/zipimportbugexample$ mkdir foobar
exarkun@charm:/tmp/zipimportbugexample$ echo "def foo(): pass" >
foobar/__init__.py
exarkun@charm:/tmp/zipimportbugexample$ zip foobar.zip foobar
  adding: foobar/ (stored 0%)
exarkun@charm:/tmp/zipimportbugexample$ zip foobar.zip foobar/__init__.py 
  adding: foobar/__init__.py (stored 0%)
exarkun@charm:/tmp/zipimportbugexample$ rm -r foobar
exarkun@charm:/tmp/zipimportbugexample$ mkdir workingdirectory
exarkun@charm:/tmp/zipimportbugexample$ cd workingdirectory/
exarkun@charm:/tmp/zipimportbugexample/workingdirectory$ 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('/tmp/zipimportbugexample/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
>>>
History
Date User Action Args
2008-10-28 21:59:40exarkunsetrecipients: + exarkun, loewis, belopolsky, gpolo
2008-10-28 21:59:40exarkunsetmessageid: <1225231180.3.0.306670127153.issue4223@psf.upfronthosting.co.za>
2008-10-28 21:59:39exarkunlinkissue4223 messages
2008-10-28 21:59:38exarkuncreate