[issue15931] inspect.findsource fails after directory change

Yury Selivanov report at bugs.python.org
Thu Jan 30 00:42:59 CET 2014


Yury Selivanov added the comment:

Hm, maybe just for the imports? This simple script, run it directly:

test.py:

   def foo(): pass
   print(foo.__code__.co_filename)

"$ python3.4 test.py" will still print relative path "test.py".

Hence, if you do 'os.chdir' in the above script, the introspection code will break.  There are many similar issues on the tracker, btw.

----------

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


More information about the Python-bugs-list mailing list