viraptor
viraptor

Reputation: 34205

Where does the initial sys.path come from

I'm trying to figure out where does the initial sys.path value come from. One ubuntu system suddenly (by which I mean probably manually by someone doing something weird) lost entries at the end of the array.

All other hosts: ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7']

That host: ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']

The /usr/lib/pymodules/python2.7 path is the one I actually care about. But where does it come from on the healthy nodes?

Upvotes: 4

Views: 679

Answers (1)

jamessan
jamessan

Reputation: 42747

It comes from the python-support package, specifically from the /usr/lib/python2.7/dist-packages/python-support.pth file that is installed.

There shouldn't be any modules installed to that directory manually and any package installing modules to that directory should have a dependency on the python-support package, so you shouldn't have to worry about whether it is in sys.path or not.

Upvotes: 4

Related Questions