joeforker
joeforker

Reputation: 41757

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

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

Upvotes: 22

Views: 2399

Answers (1)

merwok
merwok

Reputation: 6907

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

Upvotes: 14

Related Questions