Ironpython, os.system does not work correctly but does in regular Python
-
Tuesday, February 09, 2010 3:15 PMI have an output file (BuildResults.txt) which contains, you guessed it, the build results from a command line build in VC 2007. I use a Python script to build a bunch of solutions and dump the results to BuildResults.txt. I then use findstr to search BuildResults.txt for errors and report them to the screen.
Here is an example BuildResults.txt file.
------ Build started: Project: ADI, Configuration: Release Win32 ------
Compiling...
ADI.cpp
Compiling resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
Embedding manifest...
Build log was saved at "file://c:\Work\Tools\Instruments\ADI\BuildLog.htm"
ADI - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
The command to find the errors is
findstr /c:"error(s)" BuildResults.txt | findstr /v /c:"0 error(s)"
or in Python
os.system('findstr /c:"error(s)" BuildResults.txt | findstr /v /c:"0 error(s)"')
When I run this from the command line or from Python, I should not get output. But when I run it from Ironpython, I get the following.
>>> os.system('findstr /c:"error(s)" BuildResults.txt | findstr /v /c:"0 error(s)"')
BuildResults.txt:ADI - 0 error(s), 0 warning(s)
FINDSTR: Cannot open |
FINDSTR: Cannot open findstr
FINDSTR: Cannot open /v
FINDSTR: Cannot open /c:0 error(s)
Is there a way to make this work correcty in Ironpython? It works fine with Python 2.5 (not Iron).
Answers
-
Monday, April 12, 2010 3:01 AM
I suspect you're using an older version of IronPython. At some point, it wasn't correctly running os.system calls through CMD.EXE, but it is now.- Marked As Answer by Jimmy SchementiOwner Friday, May 07, 2010 6:11 PM
All Replies
-
Tuesday, February 16, 2010 3:54 AMTo quote Pink Flloyd, "Is there anybody out there?".
-
Monday, April 12, 2010 3:01 AM
I suspect you're using an older version of IronPython. At some point, it wasn't correctly running os.system calls through CMD.EXE, but it is now.- Marked As Answer by Jimmy SchementiOwner Friday, May 07, 2010 6:11 PM
-
Thursday, September 22, 2011 3:48 AM