Boost logo

Boost Users :

Subject: Re: [Boost-users] python context scope question
From: tom fogal (tfogal_at_[hidden])
Date: 2009-07-02 00:59:45


Christopher Harvey <chris_at_[hidden]> writes:
> I'm running a bunch of python scripts from a directory, one after the
> other.
> I want to make sure that those scripts don't interfere with each other.
> My code looks like this:
>
> for(directory_iterator itr(filterDir);itr!=directory_iterator();++itr) {
> if(itr->path().extension()==".py") {
[snip -- run the script in *itr, essentially.]
> }
>
> Basically what I want to know is this:
> For every iteration of the exterior for loop will any of the scripts
> that are executed be able to impact in any way another script that is
> executed?

I don't think you could possibly know that; there's just too many
possibilities. Consider:

       script1 script2
  import os import os
  fd = os.open("/tmp/a", O_WRONLY) fd = os.open("/tmp/a", O_RDONLY)
  os.write(fd, "blah blah blah") str = os.read(fd, 42)
  os.close(fd) os.close(fd)

To know that those scripts could interfere, or required an ordering,
you would need to know what they did. Which would mean you would have
to interpret them. That's the whole problem though, you want to make
sure you don't get errors during interpretation.

(While you're at it, try writing a program that can take any python
program as input and tell you if it terminates. Definitely send me a
ping back if you can figure that one out.)

-tom


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net