[Tutor] os.system and/or subprocess.call problem...
daychilde at gmail.com
daychilde at gmail.com
Fri Jul 10 19:00:11 CEST 2009
I'm working on a program that calls another program recursively - this other
program reads in ini file and processes it; my program creates a number of
slightly different ini files and calls the other program for each one.
I can successfully generate the ini file. The problem is that the other
program doesn't seem to execute it correctly; or is unable to read its
contents. I'm not sure what's going on from the error it's giving me -
basically, it says there's nothing to do in the ini, so that's why I think
it's either not reading the ini, or perhaps it's being executed as the wrong
user or something. (Linux environment)
What's really gotten me is that if I take the command that I generate and
execute it manually, either on the shell command line, or even in the Python
interactive shell, it works. It's only when I call it programmatically that
it fails.
I've tried a number of different methods, and at this point, I'm a little
confused as to which did precisely what. For a while, I was getting a "file
is busy" error, which wasn't solved by putting a few seconds' delay .
So basically what I'm trying to do is:
- Create a subdirectory (./timestamp/indexnumber - e.g.
./2009.07.08-11.55.24.12/1 - this works)
- Write a file "bsf.ini" into that directory (this works)
- Execute a program called "bluesky" from its directory, passing the
ini file along using the appropriate parameter (I'm definitely generating
the correct command to do this)
An example of the command that works, slightly changed to protect the
guilty, would be:
/home/isaac/bluesky/bluesky
-inifile=/home/isaac/loopy/2009.07.08-11.55.24.12/1/bsf.ini
('loopy' is my program. Not my choice, but it does 'loop' bluesky, so. hey.
Heh. I'm *going* loopy, but that's a different problem entirely!)
So when I execute the above on the command-line, it works perfectly. But
when I do it via an os.system or subproces.call, bluesky basically says
"hey, I found nothing to do here".
What do you think? Can it be executing bluesky in such a way that it can't
open the ini, or perhaps it's executing blueksy as a different user on the
system or something?
Sincerely,
-Isaac Eiland-Hall
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090710/cc4a0f61/attachment.htm>
More information about the Tutor
mailing list