I'm trying to run a script that tries to run a program called omniidl.exe using subprocess.call(), like so:
retcode = subprocess.call("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\os.py", line 39
return [n for n in dir(module) if n != '_']
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 = subprocess.call("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.
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?)
I have verified that os.environ is correct in my script, before the call to subprocess.call. 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?
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.