[Distutils] Interrogate distribution for an entry point command path

Thomas Kluyver thomas at kluyver.me.uk
Sat Oct 15 18:07:32 EDT 2016


On Sat, Oct 15, 2016, at 06:57 PM, Ben Finney wrote:
> I'm modifying an existing application that invokes the program as a
> subprocess, so I'm wanting to find that program as an external command.

If the entry point looks like:

foo=foomod:main

Then you can invoke it in a subprocess by running:

subprocess.Popen([sys.executable, '-c', 'import foomod; foomod.main()'])

This avoids the need to work out where the 'foo' script has been
installed to.


More information about the Distutils-SIG mailing list