[Distutils] Interrogate distribution for an entry point command path

Nathaniel Smith njs at pobox.com
Sun Oct 16 04:24:18 EDT 2016


On Sat, Oct 15, 2016 at 4:38 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
> Thomas Kluyver <thomas at kluyver.me.uk> writes:
>
>> 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()'])
>
> That will invoke the program. I'll probably try that.
>
> One disadvantage there is the process won't have an informative name;
> instead of being named ‘/foo/bar/lipsum’, it will be named ‘python’
> which is less useful.

I won't claim it's pretty to look at, but if this is a major issue
then as a workaround I suppose you can consider adding a dependency on
https://pypi.org/project/setproctitle/ and running

[sys.executable, '-c', 'import setproctitle;
setproctitle.setproctitle("foo"); import foomod; foomod.main()]

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Distutils-SIG mailing list