os.system() and PHP?

Nolan Darilek nolan at ethereal.dhis.org
Thu Jan 13 13:52:47 EST 2000


This isn't entirely a Python problem; it may very well be PHP's
fault. :) I thought I'd ask here first though before searching out PHP
newsgroups/mailing lists, since the problem is originating in a Python
script.

I'm working on an MP3 cataloging/jukebox system written in Python and
PHP. The program is controlled by a master Python script and a set of
PHP scripts. I've decided that the Python scripts would handle all
filesystem access and most table updates, thus allowing the Python
script to be called from the command line and letting the user
organize the MP3 collection and database. In keeping with Unix's small
is better philosophy, the Python script shells out to lots of
suplimental programs using os.system(). Similarly, the PHP scripts
occasionally shell out to the Python scripts to perform track editing
functions.

Here is where my problem lies. I've written a quick track editing page
which seems to work. Its goal is to read title, album and artist
information from the user, and to update that information in the
database. It then calls the Python driver script using PHP's
passthru() (For debugging only).

The script is called, yet the os.system() in the Python script which
calls mp3info doesn't work. I've inserted debugging prints into the
script and have gotten output, and I printed the return code from
os.system(), which is 256. The script works nicely from the command
line; once I edit the track I can then call the script with the exact
same command line and see the results I want.

I'm thinking that perhaps PHP's passthru() prevents os.system() from
running. Is there some sort of limitation on how many subshells a
program can spawn? I apologize if I sound confused; I'm not sure
whether this problem is with PHP, Python, or standard policies about
how os.system()-esc calls should work.

Thanks.



More information about the Python-list mailing list