Advertisement

01.30.2007 at 03:10AM PST, ID: 22141856
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Executing a subprocess and reading its output on windows

Tags: python, subprocess, output
This should be fairly easy but I can't get things to work correctly. Basically I am just trying to launch a command line argument from python and read the standard output. I first tried:

res = os.popen(cmdline, 'r')
for line in res.readlines():
   ...

The problem is that when the res.readlines() is executed, the process may still be running, and thus I am reading a partial output. I have no way to know whether I should wait or if I should proceed.

I then stumbled upon subprocess.Popen which has a wait() member. However, for some reason this does not capture the stdout very well. For example, a subprocess.Popen('cmd /C dir') will print the result on screen rather than capturing it in its result.

Finally, there is a win32pipe module with a popen and a WaitNamedPipe, but I couldn't make this to work and the documentation seems to be sparse.

Surely there must be a simple solution to this simple and common task..

Any help greatly appreciated!

cxt
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: cxt
Solution Provided By: RichieHindle
Participating Experts: 2
Solution Grade: A
Views: 117
Translate:
Loading Advertisement...
01.30.2007 at 05:37AM PST, ID: 18427422

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2007 at 06:27AM PST, ID: 18427775

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2007 at 08:13AM PST, ID: 18428691

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2007 at 09:12AM PST, ID: 18429178

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2007 at 02:11PM PST, ID: 18431753

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2007 at 04:15PM PST, ID: 18432484

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.30.2007 at 11:56PM PST, ID: 18434153

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.31.2007 at 12:08AM PST, ID: 18434199

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29