can python access OS level features like bash scripting?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Apr 19 13:55:09 EDT 2009


En Sun, 19 Apr 2009 08:16:15 -0300, Krishnakant <hackingkk at gmail.com>  
escribió:

> I need to create an installer and an executable file for my python
> program for gnu/linux.
>
> The install script has to put the package into site-packages folder
> where all other libraries reside.  Then put the executable file
> into /usr/bin as other files.

Write a setup.py script using the distutils package:
http://docs.python.org/distutils/index.html

> I believe putting files into proper places is pritty easy (may be some
> one will instantly reply to the issue of putting the executable file and
> libraries in place ).  But to do the database based activities, I need
> python-psycopg2 module for postgresql in the first place.  So is it
> possible for python to self download and install all the necessary
> modules on to the client machine?

You said you want to create a .deb -- list the required dependencies there.

> Even regarding the executable, I am confused on using bash as the script
> for writing the executable which can then do some thing like python -c
> and call the modules, or write this executable code in a main.py and put
> that file into the executable path i.e /usr/bin.

I've seen both a bash script with a single line: python path/to/main.py,  
and a Python script that just imports some modules and then calls the main  
function. Perhaps bash is more useful if your program (or any library)  
requires some environment variables to be set.

-- 
Gabriel Genellina




More information about the Python-list mailing list