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 8511131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:54:10+00:00 2026-06-11T03:54:10+00:00

I need to call a python script from C#, I’ll be doing it like

  • 0

I need to call a python script from C#, I’ll be doing it like this:

   System.Diagnostics.Process process = new System.Diagnostics.Process();
   System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
   startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
   startInfo.FileName = "cmd.exe";
   startInfo.Arguments = "/C python \"C:\\working\\projects\\python tests\\Sample Data.py\"";
   process.StartInfo = startInfo;
   process.Start();

but I now need to add in command line arguments. I’m trying to decide between just using sys.argv which seems very simple to implement or to go with argparse. If I will always pass one and only one parameter (a date), is there any advantage to using argparse?

Additional info regarding the problem (slightly tangential to the question):

The date I’m passing is a parameter for a SQL query. I could instead run this query in C# (which I would prefer) but then I will need to pass the result to python via command line arguments which seems to me to be a terrible idea but maybe this is something argparse can handle? The table has two date columns and 4 float columns. Can such a table be passed this way?

The reason I am calling python via cmd.exe and not using IronPython is (A) I only need to pass information once from C# to Python so the communication between the two is very limited and (B) the result of which is a 3D surface plot generated by mplot3d which seems like a huge hassle to make work in IronPython (which actually generally confuses me anyway), so if I am just passing the single date then this doesn’t seem unreasonable. But if I could pass that entire table easily, either by a command line argument or else some other not overly complicated method, I would be very interested in hearing how.

  • 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-06-11T03:54:12+00:00Added an answer on June 11, 2026 at 3:54 am

    Since you’re a nice clean slate of knowledgeless bliss, learn argparse. It’s piss-easy and replaces sys.arg which is now considered old, archaic, and (probably) deprecated; although you’ll find it far more common, for now, because it’s been around since Guido was a baby.

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

Sidebar

Related Questions

I need to do a blocking xmlrpc call from my python script to several
I need to run a shell command asynchronously from a Python script. By this
I need to call through to a python script from C and be able
In my python script, I need to call within a for loop an executable,
I need to call a c library from my python code. The c library
I need to call some jQuery .load() function from flash. i Use this: import
I need to execute this python script: http://superjared.com/static/code/googleMX.py I installed pyactiveresource, but when I
In Python, when I run this code: from sys import argv script, user_name =argv
Is there a way to call a program (Python script) from a local HTML
I need to pass a dictionary from a python script to a Django app.

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.