I have written a python script in processing using its graphics package, however I would like to write a second script in VS code that can call this script in processing. Is there any way of doing this as I am unsure of how?
As well as this, is it possible to run processing python in VS code as this would make life a lot simpler? I have looked online but there is very limited information on this topic
Related
I am looking for help to be able to execute a python script on oracle data integrator (ODI)
I have not found any documentation for this process
I would appreciate if someone can help me with this process
I don't know where in ODI I could do this type of execution
Essentially ODI doesn't support Python directly but there are a couple of things you can do. The things to consider are:
where you need to run the code
what you want the code to do
how integrated into ODI do you need it to be
Jython
ODI does support Jython which is a Java implementation of Python. This can be embedded within procedures and Knowledge Modules which allows you to (relatively) easily make use of the ODI metadata. It isn't particularly friendly to code or debug but is functional and powerful, you get access to ODI logging etc.
Whilst this is possible I would look to do this is Groovy rather than Jython as it is much cleaner and simpler
Shell Script
If your python script is already there and is completely stand alone you can use an OdiOsCommand inside of a package. You would need an agent installed on the box on which you want to run the script and you can just do something like
python /path/mypythonscript.py
just as you would from the command line.
This is simple enough but the integration into ODI is very limited. It will handle errors just like a shell script (so handled exceptions will be swallowed and lost) and any parameters you want to pass will need to be via the command line.
I apologize in advance if my question is badly formulated, for I don't know if what I need makes any sense.
I'm currently working on a c# project where I need to run several time the same python script from inside the program, but with different arguments each time.
For this, I'm not using IronPython, but the ProcessStartInfo class, for I understood that IronPython has some problem with certain packages I use. But this can change.
My problem is that although the python script is small and fast, it needs to import first a lot of packages, and this takes a lot of time. And therefore, my code is very slow, while 90% of the time is used to import python packages.
I can't work around the problem by running this python script a single time with many arguments.
So is there a way to "open a permanent python console" from c#, where I could import everything once, then run the small script with my first argument, get the result back in c#, then run the script a second time etc .... ? Or any other way to optimize this ?
Thanks for your help,
Astrosias.
I have an executable (face recognition) written by one of our programmers who's no longer with us. It takes a commandline argument and prints the result to STDOUT like this.
I need to be able to use this in Python but performance is important so I'm not sure if I should just use subprocess. I need to capture the output of the program so is it a better idea to modify the code to make it a C++ library instead and write a wrapper for it in Python? How would that impact performance compared to using subprocess?
I have looked into the Python docs for running C code and found this but the answer here is different. The second method does not even use Python.h so I'm a little confused. What's the best way to do what I need when performance is important?
At first I have to tell you I think subprocess method and running external application and reading output from STD output would be slow and unreliable. I won't recommend that method.
Instead, here is some suggestions:
You can create a Python extension in C or C++, you can find a lot of resources online about it. So you can convert your current code to Python extension format and just use Python extension skeleton template, integrate your functions and code in it and you'll have a python extension, simply you'll be able to call it's functions from Python code. See: http://docs.python.org/2/extending/index.html
Convert your current C++ code directly into a DLL and exports functions of your code you want to call from python if you are in Windows or simply convert it to a shared library if you are using Linux. It will be compiled to .so . Then you can call functions as an external library in your Python code. Example with explanation: http://www.linuxforu.com/2010/05/extending-python-via-shared-libraries/
I've never tried them, but it seems these projects can help you with what you want:
http://sourceforge.net/projects/pygccxml/?source=dlp
https://code.google.com/p/pybindgen/
http://www.cython.org/
I'm kinda new to scripting for IDA - nevertheless, I've written a complex script I need to debug, as it is not working properly.
It is composed of a few different files containing a few different classes.
Writing line-by-line in the commandline is not effective for obvious reasons.
Running a whole script from the File doesn't allow debugging.
Is there a way of using the idc, idautils, idaapi not from within IDA?
I've written the script on PyDev for Eclipse, I'm hoping for a way to run the scripts from within it.
A similar question is, can the api classes I have mentioned work on idb files without IDA having them loaded?
Thanks.
Now I may be wrong for I haven't written any IDA script for long time. But as far as I remember the answer to your first question is no. There is the part that loads the IDA script and prepare the whole environment so you could re implement it and create your own environment, however I would not recommend that.
What I can tell you is to consider running your script from command line if automation is what you are aiming for. IDA python (as well as any other IDA plugin) have a good support for running scripts from command line. For performance you can also run the TUI version of IDA.
There is also a hack for that enables you to launch a new python interpreter in the middle of the IDA script. It is useful for debugging a current state yet you will still need to edit the python file every time to launch the interpreter.
Here is the hack:
import code
all = globals()
all.update(locals())
code.interact(local = all)
Anyway - logs are good and debug prints are OK.
Good luck :)
We've just got a notice from one of our users that the latest version of WingIDE supports debugging of IDAPython scripts. I think there are a couple of other programs using the same approach (import a module to do RPC debugging) that might work.
My company has a C/C++ application developed using Visual Studio. Currently we have a Visual Basic plugin which lets you open a built-in text editor and run VB code. This built-in text editor gives the user all the basic debugging tools (break, watch, step...). I was wondering how could I do that using Python. The tricky part is that the python interpreter has to be launched from inside the main application, so that they have access to the same memory space.
I already have a swig interface for the application API and did a proof of concept VB script in which I loaded Python as a DLL and executed a script as described here. This works perfectly when I am sure the script has no bugs, but it would be much easier if I could have some sort of interface which I can debug the script being executed.
I had a look into the pdb module, but it dosent look like the way to go. If someone could just point me into the right direction it would be much appreciated.
I've had some luck embedding Spyder in a C/C++ program that I had created wrappers for (using PySide). Since the wrappers included the main application logic, I turned the program into a python application and then embedded Spyder using one of their examples.
However, it uses pdb or winpdb under the hood, so complete functionality is still not there IMHO.