Python from C# examples & documentation #2119
Unanswered
aggiehorns
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello. So, cutting to the chase, are there any code examples in C# and/or thorough documentation explaining how all this works? All I've seen are uselessly simple examples. I've spent the past hour trying to simply load a .py script, and execute a function defined in that script. I pass in a string, I want to get a string back. I'm sure it's staring me in the face, but no luck.
What is the difference between Py.Import(somePath) and PythonEngine.Compile(somePath) ? Searching for examples online, I see people switching between these two approaches as a way to execute a python script file.
In many examples using Py.Import() I see something like this Py.Import(Path.GetFileNameWithoutExtension(fullPath)). GetFileNameWithoutExtension() reduces the full path to just the basic name of the file. How is that functional? It can't possibly find the correct script file.
TLDR, can anybody point me to a straight forward example of how to execute a function in a script?
Thanks!
All reactions