Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can distutils install the module/package as an executable script?

I'm using distutils.core.setup for the first time. I got it to install my module in /usr/lib/python/site-packages.

If I run python from any directory and do import my_module it all works great.

However, I need to run my module as script. It's not intended as a library, but rather as an application. If I run from terminal python my_module it does not find the file.

I wanted to make an executable script that will run my module and put a sym link to it in /usr/bin, but that seems like a hacky way to solve this. I presume distutils has something to install your module as an executable script, except I wasn't able to find it. Could someone please point me to an example or doc file for this?

Edit: Also, if this is not the right way to distribute a python application, what should I use instead?

like image 844
Diana Avatar asked Jun 25 '13 05:06

Diana


1 Answers

Use

distutils.core.setup(scripts=['myprogram'])

instead of py_modules=['mymodule.py']

like image 181
merwok Avatar answered Sep 20 '22 16:09

merwok