I am trying to debug Cython code that wraps a c++ class, and the error I am hunting is somewhere in the C++ code.
It would be awfully convenient if I could somehow debug as if it were written in one language, i.e. if there's an error in the C++ part, it would show me the source code line there, and if the error is in the Python part it would do the same.
Right now I always have to try and replicate the Python code using the class in C++, and right now I have an error that only occurs when running through Python ... I hope somebody can help me out :)
It's been a while for me and I forgot how I exactly did it, but when I was writing my own C/C++ library and interfaced it with swig into python, I was able to debug the C code with DDD. It was important to compile with debug options. It wasn't great, but it worked for me. I think you had to run ddd python and within the python terminal run my faulty C code. You would have to make sure all linked libraries including yours is loaded with the source code so that you could set breakpoints.
Related
Recently, I learned that C++ codes runs faster than Python. We have post-processing Python script which takes huge time to run. So, I'm thinking of replacing them with C++ code. I know that C++ code can only be used for Post-processing, and that is fine for me.
I am not sure how to run the C++ code in Abaqus. I know that I need a compiler to compile the C++ code, like Visual Studio. But I don't know about integrating it with Abaqus and overall flow to compile and run the script.
Any help will be much appreciated!
Recently, I have the same problem with you,if you want to use C++ you must use the script in command: abaqus make job=filename.cpp.Then abaqus will give you a file:filename.exe,I think that C++ is same as fortran,I couldn't link it to abaqus ,so I couldn't run the .exe file,if you can solve my problem I would appreciate that you could answer me.
I just started accessing py-files from C# via IronPython and for simple files it worked very well. However, accessing py-files that were used in a Visual Studio Python project is not quite as easy, because the pyproj-file configures imports and requirements and I am having difficulties replicating all of that with IronPython.
I basically want to access everything the Python software can do by invoking its modules from C# with IronPython. Does anyone know what the proper approach to do that is?
I tried just adding everything inside of "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib" to my search path, including subdirectories. I successfully gathered all the paths and added them to the engine. I tested it by accessing a few MS shared modules and I don't get the "No module named XYZ" error, but mostly a generic "token error" instead, so putting the paths into the engine must've worked at least.
But what else do I have to do to get the software to work? Am I merely missing some further include paths or is there something else I'm missing, too?
edit: I just found a comment in this answer saying that IronPython isn't compatible with Python 3.x yet, and said comment responded to someone complaining about token errors similar to what I've been seeing. So I guess IronPython is out, then? I'm too much of a newbie to know whether for sure, e.g. there might be ways to make it compatible? I don't know.
How can I set my path so that I can easily switch between several coding languages? I am new to stuff like this so I appreciate any help.
You shouldn't have to set anything. Whatever reads your python code is a completely separate entity from what compiles/understands your C++ code. Your operating system's PATH variable contains a list of places for the system to look for programs.
Your python and C++ tools can co-exist in your PATH without butting heads or causing any issues. I have C++, python, and C# stuff all installed and they get along fine.
I'm trying to get back into coding for some math/physics experimentations and found VTK as a powerful tool using python. So I installed Python(x,y) and Pycharm Community edition. But I cannot get the Code Completion for VTK to work. I know this question has been posted quite a lot of times, but I couldn't find any concrete answer.
Here's what I know so far:
In order for Code Completion to work Pycharm constructs Skeletons. (Basically Python files with empty Classes/Methods that match the C++ API and can then be used like any other Python file for code completion.)
If I locate these files they don't appear to be complete and look something like this:
If this is indeed the skeleton (the file is called vtkRenderingPython.py) then shouldn't there be empty function declarations?
The result is that I get code completion for the classnames, but not the functions. For a library this huge that's rather annoying. Is there an easy way to get this working, or is this just a limitation I have to live with? Is there maybe a way to get complete Skeletons and replace the ones I have here? Am I missing the point entirely?
After another couple of hours I tried my luck with the PyDev extension for Eclipse. I didn't think that would work, but to my surprise it did! No settings necessary, it just worked out of the box.
The only drawback is that inherited methods are not shown in code completion. The base class is shown in the documentation window though so you can get the available functions by creating a temporary object of the base class and scrolling through the code completion there.
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.