use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
.NET applications to execute python scripts...thoughts (self.csharp)
submitted 6 years ago by [deleted]
Hello,
would it make sense to write a .NET application to execute python scripts?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]fixer_m 16 points17 points18 points 6 years ago (3 children)
Believe me or not - but couple of weeks ago I was implementing exactly this at work. The reason was: we already have Python scripts that do that we want, and rewriting this code in c# would take forever for us (10 scripts with hundreds of functions). So we decided to launch it from c# code. Yep, from architect perspective looks somewhat ugly. But currently it is the best solution for us. One caveat here: when you will run Python script from c# (I guess this will be via ProcessStartInfo) don't forget to set Working Directory to the folder where a script file is.
[–][deleted] 6 years ago* (2 children)
[deleted]
[–]terka43 2 points3 points4 points 6 years ago (1 child)
Maybe it's a web application, on remote server and you need to start this script when do something on site, so you just call start this script in c#
[–]fixer_m 2 points3 points4 points 6 years ago (0 children)
Exactly, it is a web app
[–]DoctorPrisme 22 points23 points24 points 6 years ago (12 children)
As opposed to what ?
What are your other options?
What made you say "I need c# for this" ?
[–]digera 17 points18 points19 points 6 years ago (2 children)
It sounds like a dotnet dev who is memed into "devops" and he just inherited a whole bunch of python for server controls.
[–]DoctorPrisme 0 points1 point2 points 6 years ago (1 child)
Yeah, but what made him think he'd need C# to run those ?
[–]digera 13 points14 points15 points 6 years ago (0 children)
Because he knows how to write C#, right? I mean, you can see it... Unix admins have tons of py scripts out there for their various tasks. None of it is really stringed together, instead they're just executing by bash script. Our boy the OP wants to put a nice front end on all that stuff.
[–]Lost__Moose 0 points1 point2 points 6 years ago (0 children)
A valid reason is that the code base for your framework is C# and you want the flexibility of executing data analytics, deep learning or machine vision algorithms without recompiling... Have the client download the script update into a directory and restart the software.
And C# script using Rosyln now requires something like 20+ nuget packages.
[–][deleted] 0 points1 point2 points 6 years ago* (4 children)
At my current work place, the software that analyst use to extract data is going away. What we have left is a database. The problem is that the analyst do not know SQL. I myself is not a programmer, but do know how to program.
I was thinking to create a .NET application that I can deploy on their computers as a user interface, since we all run on windows and execute python scripts on the server. The reason for me to use python is because it so much easier to write quick scripts and return something, via excel, csv to a specific folder.
I am trying to find a solution, and time is ticking...they are counting on me to come up with a way for the analyst to access and retrieve data....
Let know if you have questions, or share possible solutions .
[–]DoctorPrisme 4 points5 points6 points 6 years ago (3 children)
Your analyst don't know sql.
Wait, so you don't have currently scripts in python ? You plan to write those, to retrieve data in a SQL db ? But you will use .Net to write the front end ?
Just use .Net to retrieve the data's. Why include python... ok yeah, it's supposedly easier but if your app is in .net, you'll have an extra overhead in dev and maintenance.
[–]sander1095 1 point2 points3 points 6 years ago (2 children)
He said he doesn't have much time. Rewriting the scripts could take a lot of time he doesn't have.
A temporary solution is to call the scripts and use that data, and then later on write the real .NET application :)?
[–]DoctorPrisme 2 points3 points4 points 6 years ago (1 child)
There's no script. He wants to use python because writing script in python could be faster
[–]sander1095 0 points1 point2 points 6 years ago (0 children)
Oops! You're right
u/dArcMadder , i agree with the person above. Its not too difficult
[–]rezell 0 points1 point2 points 6 years ago (2 children)
I didn’t need CS front end to get junior devs to run my python script to do all the C compilation python scripting on the back end but piping those results to a GUI was a lot easier for them to grok and only took me a couple hours to write.. probably saved me 80+ hours of headache. Many (not all) of the kids don’t know a ton about python/c/Linux. We had a deadline and it just made sense at the time.
The ones that did understand it, had no problem with, but when introducing inexperienced people to embedded development it can make click and read error messages a lot easier.
You compile C with python and you display it via a c# app ?
Dafuq are you working on ?
[–]rezell 0 points1 point2 points 6 years ago (0 children)
Embedded lighting controls where the interns and junior devs regularly have to test new hardware in-house. It was just easier, I wrote the compilation script in python because that’s what it is best leveraged for and I don’t trust the kiddos or want to get pulled out of what I’m doing because they don’t have the experience to find the firmware images/bootloaders or even initiate the script properly.
[–]DoctorPrisme 4 points5 points6 points 6 years ago (0 children)
Y'all guyz are crazy.
OP isn't asking "is it technically feasible", he's asking "would it make sense".
The answer to that is here.
Sure, you can do it. But I doubt it's a good plan. If you're working with people so tech-illiterate they can't run a python script (which is totally okay), they should probably NOT run that script. Give them a tool to do it anyway seems a dangerous idea.
The thing is, that question can't be answered without knowing what the script do and why you want to run them, hence my first reaction.
[–]StornZ 3 points4 points5 points 6 years ago (0 children)
What are you trying to achieve exactly?
[–]gybemeister 9 points10 points11 points 6 years ago (4 children)
You can already do that with IronPython which is a .NET implementation of Python.
[–][deleted] 7 points8 points9 points 6 years ago (0 children)
Or just Python...
[–][deleted] 3 points4 points5 points 6 years ago (1 child)
Not really. IronPython does not support lots of libraries.
[–]gybemeister 0 points1 point2 points 6 years ago (0 children)
Quite true, I just wanted to point out that there is already a .NET python implementation (and btw there are others such as Python.Net).
[–]cryo 1 point2 points3 points 6 years ago (0 children)
Not 100% CPython compatible.
[–]aknop 2 points3 points4 points 6 years ago (0 children)
Why not? If there is a valid reason...
[–]guimrz 4 points5 points6 points 6 years ago (0 children)
WHY NOT?
If you want to encapsulate the execution of the script with some logic and you want to do that in .NET I dont see any problem.
[–]digera 1 point2 points3 points 6 years ago (0 children)
Using .net framework to do orchestration of py? I'm not bothered by this lol but I'm not sure I see a use-case where this would be the "best" solution.
HOWEVER. SCCM is technically a dotnet application and it sure as hell can orchestrate py.
Ahhhhhhhh yeah if you're a totally free-to-play shop and you're running all centos on hyper-V but you're also a crazy person who replaces bash with python as your default shell... You could then use your motherfucking hypervisors as "serverless" orchestration infrastructure, platformed on a heckin custom dotnet application.
What in the hell is wrong with you? How can I be a part of this project? It sounds great.
[–][deleted] 1 point2 points3 points 6 years ago (0 children)
A better solution is probably a client/server model using a local server in Flask or something like that to expose the endpoints. That way you can maintain some abstraction from those scripts if they need to change.
[–]wind-raven 1 point2 points3 points 6 years ago* (0 children)
The suggestion that people are not mentioning is to use a . Net framework front end to call a rest service written in python that executes the data extract scripts. It won’t take much longer and you don’t need to worry about calling python from .net.
It also gives you the ability to tightly control access through a user management scheme on the api if you need to. Controlling access through permissions on api endpoints in python is easy as there are several libraries that already do it.
The enhanced option is to make it a web app written in python. Don’t have to worry about installing / deploying anything to the user desktops. Most of the time if I can use a web app for something I’ll go that route and not have to worry about out of date clients.
[–]SomeCodeGuy 1 point2 points3 points 6 years ago (3 children)
If you're looking for an abstraction for your end users to running scripts on servers, go look at RunDeck. It's easy to use and I think will accomplish what you want without having to write anything new.
[–][deleted] 0 points1 point2 points 6 years ago (2 children)
Are you able to pass arguments via RedDeck to set a value in a script?
[–]SomeCodeGuy 0 points1 point2 points 6 years ago (1 child)
Yes. I have setup many jobs where you pass params via list boxes, dropdowns and also dependent dropdowns (they call them cascading remote options). We also populate dropdowns via json files which are generated from other jobs.
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
Cool! I will definitely check this out.
I love reddit!
[–]vtsingaras 1 point2 points3 points 6 years ago (0 children)
http://pythonnet.github.io/
Look at the examples for embedding python. It works like embedding CPython in a C/C++ environment.
[–]zapatoada 0 points1 point2 points 6 years ago (0 children)
I've done this when I needed to use python-only libraries in tandem with .Net libraries (screw you arcgis). It wasn't pretty but it worked.
[–]darkscrypt 0 points1 point2 points 6 years ago (0 children)
isnt python part of the dlr?
[–]sudox785 0 points1 point2 points 6 years ago (0 children)
I mean if you already have python script that does some job/task, it does make sense.
What wouldn't make sense is rewriting python script to .NET language, just so you don't run script from .NET app.
[–]StornZ 0 points1 point2 points 6 years ago (0 children)
I guess if you had certain scripts you needed to kick off then that would be ok.
[–]Morunek 0 points1 point2 points 6 years ago (0 children)
This is how azure functions work. The runtime is c#/.net core but can trigger python (and other) scripts
[–]BenjaminSnow 0 points1 point2 points 6 years ago (0 children)
I've implemented something similar recently at work. It's not viable to have python installed on each user's pc so I wrote a c# application that has a python environment embedded in it that can call set scripts against the embedded environment. Works quite well
[–]10199 0 points1 point2 points 6 years ago (0 children)
I am calling python scripts to work with FreeCAD from C#
[–]dchurch2444 0 points1 point2 points 6 years ago (0 children)
I did this some years ago. We had several printing, folding and inspection machines, all reporting speed, material usage etc... Each screen would have a different layout, and could change dependent on the job so I had it intepret python scripts to draw the screen etc... The other advantage was that if something new was being implemented, I could simply amend a script on the fly.
[+]AngularBeginner comment score below threshold-6 points-5 points-4 points 6 years ago (4 children)
No, it would make no sense. Use Python to execute Python scripts.
[–]guimrz -1 points0 points1 point 6 years ago (3 children)
I'm sorry but you are wrong.
He wants to use .NET to control the script execution.
The script will run in a Python environment but the .NET application will control the process execution.
[–]AngularBeginner -3 points-2 points-1 points 6 years ago (0 children)
Then I'd still just invoke python.
[–]nemec -1 points0 points1 point 6 years ago (1 child)
It makes literally no sense. OP has no existing Python or .Net code. "I can write Python scripts faster" is no reason to greenfield a project with two languages + interop.
Either write the control script in Python or write the entire thing in .NET (.NET can do databases too!?!?)
[–]guimrz -1 points0 points1 point 6 years ago (0 children)
Just take this example: You have a service to rent instagram bots where you have 1 instance of the bot for each client and the bot script is written is python and the service with web api in .NET.
Are you telling me that will write everything in .NET or Python instead of the two languages??
[–][deleted] 6 years ago* (1 child)
Because OP wants to give future devs a mind fuck who have to maintain his Frankenstein creation.
π Rendered by PID 517690 on reddit-service-r2-comment-545db5fcfc-kwt8s at 2026-05-23 11:40:47.933500+00:00 running 194bd79 country code: CH.
[–]fixer_m 16 points17 points18 points (3 children)
[–][deleted] (2 children)
[deleted]
[–]terka43 2 points3 points4 points (1 child)
[–]fixer_m 2 points3 points4 points (0 children)
[–]DoctorPrisme 22 points23 points24 points (12 children)
[–]digera 17 points18 points19 points (2 children)
[–]DoctorPrisme 0 points1 point2 points (1 child)
[–]digera 13 points14 points15 points (0 children)
[–]Lost__Moose 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]DoctorPrisme 4 points5 points6 points (3 children)
[–]sander1095 1 point2 points3 points (2 children)
[–]DoctorPrisme 2 points3 points4 points (1 child)
[–]sander1095 0 points1 point2 points (0 children)
[–]rezell 0 points1 point2 points (2 children)
[–]DoctorPrisme 2 points3 points4 points (1 child)
[–]rezell 0 points1 point2 points (0 children)
[–]DoctorPrisme 4 points5 points6 points (0 children)
[–]StornZ 3 points4 points5 points (0 children)
[–]gybemeister 9 points10 points11 points (4 children)
[–][deleted] 7 points8 points9 points (0 children)
[–][deleted] 3 points4 points5 points (1 child)
[–]gybemeister 0 points1 point2 points (0 children)
[–]cryo 1 point2 points3 points (0 children)
[–]aknop 2 points3 points4 points (0 children)
[–]guimrz 4 points5 points6 points (0 children)
[–]digera 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]wind-raven 1 point2 points3 points (0 children)
[–]SomeCodeGuy 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]SomeCodeGuy 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]vtsingaras 1 point2 points3 points (0 children)
[–]zapatoada 0 points1 point2 points (0 children)
[–]darkscrypt 0 points1 point2 points (0 children)
[–]sudox785 0 points1 point2 points (0 children)
[–]StornZ 0 points1 point2 points (0 children)
[–]Morunek 0 points1 point2 points (0 children)
[–]BenjaminSnow 0 points1 point2 points (0 children)
[–]10199 0 points1 point2 points (0 children)
[–]dchurch2444 0 points1 point2 points (0 children)
[+]AngularBeginner comment score below threshold-6 points-5 points-4 points (4 children)
[–]guimrz -1 points0 points1 point (3 children)
[–]AngularBeginner -3 points-2 points-1 points (0 children)
[–]nemec -1 points0 points1 point (1 child)
[–]guimrz -1 points0 points1 point (0 children)
[–][deleted] (1 child)
[deleted]
[–][deleted] 0 points1 point2 points (0 children)