Next: Redirecting the output of spawned processes, Previous: Hello World! in python, Up: Python FAQ

##### 16.8.7.2 Spawning external processes

There exist various solutions to spawn external processes from a script:

- Use the functionalities provided by the `GPS.Process` class
- Execute a GPS action through `GPS.execute_action`.

  This action should have an `<external>` XML node indicating how to launch the process

- Create a pipe and execute the process with `os.popen()` calls

  This solution doesn't provide a full interaction with the process, though.

- Use a standard expect library of Python

  The use of an expect library may be a good solution. There are various python expect libraries that already exist.

  These libraries generally try to copy the parameters of the standard `file` class. They may fail doing so, as GPS's consoles do not fully emulate all the primitive functions of that class (there is no file descriptor for instance).

  When possible, it is recommended to use one of the methods above instead.