I know i can access a Dynamics instance from a python script by using the oData API, but what about the other way around? Is it possible to somehow call a python script from within Dynamics and possible even pass arguments?
Would this require me to use custom js/c#/other code within Dynamics?
You won't be able to nativley execute a python script within Dynamics.
I would approach this by placing the Python script in a service that can be called via a web service call from Dynamics. You could make the call from form JavaScript or a Plugin using C#.
Related
I am thinking of adding python scripts for some data analysis but I am using a MERN stack for my application.
An example of what I am thinking-
My python script will do some data analysis when an endpoint is being called.
../api/dopythonhere and return a JSON object
What would be the best/efficient way to implement python with a MERN stack?
So as far as I understood you have currently an API or full-build functional application made in or partially coded in Python (unknown stack). Therefore you want to migrate this to MERN Stack or call the Python API via your MERN application. There are several things you can do to work with this, but those two might be the cleanest:
Completely migrate and integrate your Python app into your Node.js & Express app and forget about the Python source code.
If it's not already done, make the Python app a functional web API. Therefore you can call it either from the Node API using libraries like Axios or similar (so in your API you can modify the data structure and only send to the front what you need), or you can also call the Python API directly via React front-end, using web development vanilla APIs or any libraries you want.
I am developing a spring boot application, where it needs to call a python script with few arguments and get back the results from python. I need to develop the application as a single unit that is portable. I have an idea of using maven jpython/python integration (making jar file of python + libraries for python stuff). Is this possible? If it is how to do that? Or another way to do maven python integration?
it needs to call a python script with few arguments and get back the results from python
Not sure if you really are familiar with Spring Integration, but since you mention that tag, I'm going to share with you a scripting support in that project when Python language is one of those which you can use for such an integration: https://docs.spring.io/spring-integration/reference/html/messaging-endpoints.html#scripting
Here is also some sample project with scripting support: https://github.com/spring-projects/spring-integration-samples/tree/master/applications/cafe-scripted
I am trying execute a node.js script inside python code running in Google App Engine. Something like this below:
from Naked.toolshed.shell import muterun_js
def foo(parameter):
response_from_js = muterun_js('./views/api/generateSignedTransaction.js',
parameter)
response = response_from_js.stdout
But Naked cannot be used inside GAE because of its dependencies on C and inbuilt libraries like subprocess.call(), subprocess.check_output() and os.system() did not work as well I am guessing due to the same reasons as they execute system calls they would have C dependanices. Is there any alternative to passing parameters and executing the node.js script which would work in GAE?
In your case, depending on what generateSignedTransaction.js does, you can create a Google Cloud Function with your JS script, then, just call it from your Python.
My background:
I am just starting to learn backend development with only 1 django backend created and deployed. I have solid experience with game development, architectures, algorithms, and various technologies and languages.
The Setup:
I have a python script (call it the solver), which runs a complex calculation of some data. I cannot modify the calculation script; I can only modify the way they are called. Currently it works by typing solver.py "params" in a terminal, which returns the calculation results in a file. I have modified this to work by calling a method execute() which returns the solution as string (or a json/yaml object).
The Task:
I need to create a very simple desktop offline application to call the solver and output the solution. The OS is unknown at this stage (possibly Windows). There should be no requests to a remote server whatsoever (otherwise it would be a simple task) and the application should be run from a single file (e.g. solver.exe).
Thoughts and Questions:
My first thought was to create a simple django/flask local server and an Angular frontend. I know building angular apps with electron is simple, but I have no idea how to include the django/flask local server, how to create one locally for that matter and how to bundle them together. If you believe this is the simplest way, could you point me to some tutorial/video/library/framework that I could follow or use?
Second thought was to just create everything with django, which also has frontend capabilities. In this case, are there any packages, that would help me build the application offline and for desktop?
Third thought (I would love it if this was possible) is to just create an Angular application, which calls the execute() method (or runs the file with parameters) and to build it with electron. If this was possible, I could build the application in a day, which would make the customer very happy. From my research, I couldn't find a way to make this work. Any suggestions?
Did you already look into ngx-electron?
You can access electron through angular and then call a ChildProcess on NodeJS to spawn/execute your command.
Include your script into the bundle, call it from the command using the information provided in the links above.
We using AngularJS as a frontend for our web application and some of the functions we are using python to do the calculation and get results back.
I would like to know is there any way to calling the python script directly in AngularJS? right now we are using $HTTP service to call PHP then in PHP using EXEC command to call the python, it is all working fine.
The problem is we notified there is about 5 seconds delay every time the python script call and I guess it is because of the overhead for the python interpreter and try to start it every time, we would like to eliminate that delay.
We are run on Redhat v 6.8 / AngualarJS 1.4x and Python 3.6 Anaconda3
Does anyone try something like that? any suggestions are welcome.
Thank you!
You could write a python method that calls your calculation code and expose that method as a REST API.
You would need a library like Flask.
This tutorial explains how to do that : https://www.codementor.io/sagaragarwal94/building-a-basic-restful-api-in-python-58k02xsiq
This way you can directly call the python API.