Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do python .pyc files contain the absolute path of their source code?

Tags:

Why do python .pyc files contain the absolute path of their source code, instead of a relative path or something else?

A typical __init__.pyc from Python 2.7 on Ubuntu:

\ufffd\ufffd\ufffdOc@sddlTdS(i\ufffd\ufffd\ufffd\ufffd(t*N(tdbapi2(((s&/usr/lib/python2.7/sqlite3/__init__.py<module>s

like image 243
joeforker Avatar asked Jun 25 '12 14:06

joeforker


1 Answers

To give the information in tracebacks. See for instance http://docs.python.org/library/compileall#cmdoption-compileall-d

like image 145
merwok Avatar answered Nov 09 '22 13:11

merwok