0

I have a bunch of .cs files (c#) files that I would like to run but I am not sure how. I recently installed Python .Net from this website http://pythonnet.sourceforge.net/readme.html#installation and I have been trying to follow a prior post similar to my question but with little success. Run a C# application from python script Using the

import subprocess
import clr

cmdLine = "C:\Users\Jessica\Desktop\TD Ameritrade .NET SDK v1.0.4 Beta\TDAmeritrade\LoginRequest.cs"
subprocess.Popen(subprocess)

I am trying to open and run the file associated with with this DSK that allows the user to pull financial data into python for charting/stuying/etc.

https://tda.codeplex.com/

Community
  • 1
  • 1
jessica
  • 1,325
  • 2
  • 21
  • 35
  • 1
    You are trying to run a **.cs** file, which isn't executable. You will have to compile the csharp file into an executable file **.exe** (assuming windows). Check _Command-line Building_ @ http://msdn.microsoft.com/en-us/library/78f4aasd.aspx, for instructions on compiling using command line, or you could use Visual Studio to compile the cs file. – Learner Dec 13 '14 at 17:21
  • Mephy, I referenced the link your mentioning in my question because I was unable to replicate it. – jessica Dec 13 '14 at 17:24
  • Thanks for the help Learner. But lets say I am able to "compile" the .cs file I am trying to run. Would I then be able to open and run the file through python? Can you write C# code in python and have it work? – jessica Dec 13 '14 at 17:28
  • 1
    Jessica, You will be able to run the file, the way you are trying to do. But, if you are planning to access the objects declared in the .cs directly like python objects that will be tough. I have not used IronPython (http://ironpython.net/), but AFAIK it helps you integrate python and .NET. You might want to take a look at it. – Learner Dec 13 '14 at 17:32
  • I really appreciate your help Learner! Based on a cursory glass of this link https://tda.codeplex.com/. If I wanted to operate these files, would you go the Python .Net route or the IronPython? Thank you so much! – jessica Dec 13 '14 at 17:42
  • 1
    Sorry, not sure about what to use. But based on the python.net site's description and http://stackoverflow.com/questions/1168914/ironpython-vs-python-net . Since, you are planning to integrate a completely .NET (TD Ameritrade SDK), I would opt for IronPython. But I think you should do a bit more research than following a noob's advice. – Learner Dec 13 '14 at 17:57
  • Thanks learner for all the help! God Bless you! – jessica Dec 13 '14 at 18:14
  • 1
    BTW, I just went through the TDA SDK at github. The SDK looks pretty straightforward, only bunch of HTTP Calls exchanging XMLs, with the main file being https://github.com/kriasoft/TDAmeritrade/blob/master/TDAmeritrade.Client/AmeritradeClient.cs . Since, you are familiar with Python more you should be able to implement this without much trouble. ;-) – Learner Dec 13 '14 at 18:17
  • 1
    Thanks Learner. I am trying my best to learn all about this. I am not a software developer/hardcore coder. My background is more in math/statics. Running data analysis in R and Matlab. All the coding I hae done has always been for data analysis purposes and never really ventured outside R/Matlab application. Python is very versatile. It can do a lot! It has a this module called numpy that can allow me to do all my analysis in it. I am trying to get streaing data which then I can use the numpy module to do charting/model building etc. – jessica Dec 13 '14 at 18:42
  • 1
    So XMLs, HTTP, C#, C++ is this all over my head :). I feel a bit like a Alica walking around in the wilderness. – jessica Dec 13 '14 at 18:43

0 Answers0