[Tutor] os.system and/or subprocess.call problem...

daychilde at gmail.com daychilde at gmail.com
Fri Jul 10 19:24:11 CEST 2009

: Actually it sounds like you're calling it iteratively, not recursively.

:blush: Indeed.
: From what you write in here, my first thought is that the ini file
: isn't being flushed out to disk before the subprocess starts up and
: tries to read it.
: Are you either calling <file>.flush() or <file>.close() or something
: equivalent BEFORE starting the subprocess?

        self.filename = 'bsf.ini'
        self.fullpath = self.thispath + self.filename
        self.fh = open(self.fullpath, 'w')

Which doesn't show where the vars come from, but I am closing the file

: When you start the subprocess, is it being started in the directory
: you think it is?

Well... I know that when I use os.system to create a directory, it starts in
cwd, which in this case is /home/isaac/loopy/ -- I create a directory with
the timestamp as the name, and successfully write out the bsf.ini files into
subfolders underneath it... so I think I'm confident that, at least when I
use os.system, it executes in cwd -- but I specific the path to the command,
so I think that doesn't matter anyway, e.g.:


And I know the above is valid otherwise, as I have put in a print statement
and copied the actual line I generated and it executed fine... :)

Thank you for your reply; I appreciate all help I get on this. :) -Isaac

More information about the Tutor mailing list