So I have an entry point defined in my setup.py [console_scripts] section. The command is properly installed and works fine, but I need a way to programatically find out the pat
You could get the path for site_packages directory as follows:
from distutils.sysconfig import get_python_lib
get_python_lib()
If your script is somewhere relative to that path, either in site-packages or up a directory you could then join the relative path with the site-packages path as follows:
import os
scriptPath = os.path.realpath(os.path.join(get_python_lib(), '../my/relative/path/script.exe'))
Another trick you could try is to import the associated module and then look at its file parameter. You could then look for your script the same way as the example above if you know what the relative path is to that file. Try it on the command line interface..
import django
django.__file__
/usr/lib/python2.6/site-packages/django/init.pyc
modulePath = os.path.split(django.__file__)[0]
scriptPath = os.path.realpath(os.path.join(modulePath, '../my/relative/path/script.exe'))
Is the above advice on the right track?