Error running script that starts a subprocess

Tim Black
  • Tim Black

    Tim Black - 2009-06-26

    I'm trying to run a script that tries to run a program called omniidl.exe using, like so:

    import subprocess
    retcode ="omniidl", shell=True)

    As soon as I get to Popen.__init__()-->_execute_child()-->CreateProcess() the following error is printed:

    'import site' failed; use -v for traceback
    Traceback (innermost last):
      File "<string>", line 1, in ?
      File "c:\Python25\lib\", line 39
        return [n for n in dir(module) if n[0] != '_']
    SyntaxError: invalid syntax

    The location of omniidl.exe is properly pointed to by my PATH env var and I can successfully run this same command:
    0. via the DOS command line: "omniidl"
    1. via Python command line: "retcode ="omniidl", shell=True)"

    The expected output is "omniidl: No files specified. Use 'omniidl -u' for usage."

    Any idea what might be going on here? I'm using Windows XP, Python 2.5.2, Eclipse SDK Version: 3.3.2 Build id: M20080221-1800. Pydev version 1.3.22.


    • Fabio Zadrozny

      Fabio Zadrozny - 2009-06-27

      Have you checked if the process running has the path/pythonpath variables correct through os.environ? (maybe you have more than one python installed and the wrong one ends up available in the path?)



      • Tim Black

        Tim Black - 2009-06-29

        I have verified that os.environ is correct in my script, before the call to But the process I'm invoking is a win32 executable, not python.

        The process does, however, have python embedded in it, however. The executable does some processing and then imports a customizable python module and calls a function in it. But I'm calling omniidl with no parameters, which should just immediately print out an error and not even invoke the python interpreter. That is why I posted it on pydev instead of omniidl. It smells like an eclipse thing, bc I can do all the same operations manually from the dos command line...

        Any other ideas?