Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7418741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:56:23+00:00 2026-05-29T07:56:23+00:00

I’m absolutely bewildered by this issue. Let me give a quick run down of

  • 0

I’m absolutely bewildered by this issue. Let me give a quick run down of the program I’m making:

I’m building a harness that takes an indefinite amount of python scripts, runs the scripts, parses the StdOut/Err, write those results to a database.

I’ve been building it from the bottom up and now I need to piece all the pieces together. However, I’ve been having issues debugging. I usually don’t make console applications, yet for the purposes of what I’m doing, there is no alternative (namely, my objective is to make a console application that takes the python scripts as arguments).

So, inside my namespace I have two main classes that I’ve separated into two different files for clarity’s sake. All the functions within are static so it’s really just an organizational thing. The two files are “Harness” and “Query” respective to the python running output capturing app I wrote and the database reporting app I wrote. Now I’m trying to have the results of Harness go into Query. So that the code is easier to maintain by my peers I am trying to keep them in separate files so that it is more easily digestable.

The problem is that when I launch my command line and navigate the executable and run it passing in a sample python script as an argument, I only get the console output from the Query half of the application. I’ve put some Console.WriteLines in the main(string[] args) function within the Harness file but these never get written. Only the code inside the second Query class is executed–sort of.

Here’s where stuff really begins to confuse me, one of the functions inside my Harness half of the app writes to a log text file that time stamps the run and should report the results. This text file is still being written to. I then thought about having my sample py file output to a text file as my redirect std out was not working apparently. Sure enough, the python opened that text file and wrote to it, suggesting to me that it did indeed run that code.

Yet the function these logging calls are in contains Console.WriteLines that don’t output to console. The only time Console Output is working, is in the second half of the app.

If anyone could shed some light on these issues, I’d really dig it. A lot of the code I have contains some sensitive data so I’d rather not just give a big dump of it, there’s really no specific area of the code that I feel is relevant to the issue–admittedly I don’t know for sure. Let me know what you need from me and I’ll do my best.

        List<string> retList = new List<string>();
        // Loads Python
        Process pr = new Process();

        pr.StartInfo.FileName = @"C:\Python27\python.exe";
        pr.StartInfo.Arguments = script;
        Console.WriteLine(script);
        //pr.StartInfo.Arguments = @"C:\PythonProj\hello.py";
        pr.StartInfo.UseShellExecute = false;
        pr.StartInfo.RedirectStandardOutput = true;
        pr.StartInfo.RedirectStandardError = true;

        // Runs Test Script
        pr.Start();
        string output = pr.StandardError.ReadToEnd();
        pr.WaitForExit();
        Console.WriteLine(output);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:56:25+00:00Added an answer on May 29, 2026 at 7:56 am

    Well, the first problem, as I would have expected, is that you have possible deadlock conditions here. I don’t see where you’re reading from standard output at all, and since you’re redirecting both output and error you need to be careful about how you read from them so that you don’t deadlock. The MSDN pages for the redirect properties in Process discuss this issue, and have code examples that should be sufficient for your purposes.

    If the problem is that you aren’t seeing the output of the process in your console, so far I don’t see where it should be written (or read from the Process for that matter). Did you omit it for brevity? If so, please include it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.