We are trying to debug C++ code called by a Python script (using subprocess.call). Is there a way to do this with PyDev? I am a Java developer and we are developing an Eclipse RCP application, and can write custom code as needed to make this work.
If you want to debug c++ code, you need a c++ debugger (and PyDev won't really help you there).
My suggestion is looking for a c++ debugger in this case (you can use gdb in windows and linux -- on windows you can also use visual c++ if you want -- you should be able to attach to a running process on both cases -- I think that CDT also has some gdb integration which you can use if you set it up properly).
I've been messing around with Selenium in python, and I really want to have an existing C++ program run my python code.
Basically, my python code just finds a website, and downloads the file which afterwards my C++ program wants to open the file and do a bunch of operations on it. If I had a myPythonCode.py file, and my other C++ files (header.h, main.cpp, otherFunctions.cpp...) how would I go about running the python code from my C++ program?
Also both of my programs are console programs, and I was hoping that a user would have an uninterrupted experience running the program (for example, if the user wants to download a file while running the C++ program the terminal doesn't have to close, or open a different window to start the python program). Any help in going about this would be greatly appreciated!
It is operating system specific, and the C++11 standard does not define any functions for that (except system(3), which is in C99, and std::system in C++11). On Linux (and other POSIX systems), read Advanced Linux Programming and consider using system, or popen(3), or more probably the lower-level syscalls(2) like fork(2), execve(2), pipe(2), dup2(2), etc etc.... You may want some IPC and you may need to have some event loop around a multiplexing syscall like poll(2)
You could use some C++ frameworks like Qt or Poco (both have a process abstraction and are usable on several operating systems, even on proprietary ones from Microsoft)
If you want your C++ program to have a terminal interface on Linux, consider ncurses and/or readline
BTW, several C or C++ libraries for HTTP exist, e.g. libcurl for HTTP client side, and libonion for HTTP server side. So you might avoid your Python program and incorporate the downloading in your C++ application.
Check out the boost library which allows running python on C++ and using your C++ in python. https://www.boost.org/doc/libs/1_49_0/libs/python/doc/
My C++ application contains Python (2.7.6) code calls. I am using Visual Studio 2010 for C++ debugging and IntelliJ IDEA 13 as Python debugger.
I am looking for a way to stop at break points set in IntelliJ while calling Python from C++ code being debugged in Visual Studio.
Thank you!
Hi does anyone know if you can compile Python code into a Windows DLL file? How would you go about doing this?
One way would be to create a C or C++ library that embeds the Python interpreter and runs your Python code.
Another option would be to translate you Python code to C++ with ShedSkin and make that a DLL, although I wouldn't expect a very clean API to come out of this.
What's the best way to call python scripts from Visual Basic 2005?
I've got an application written in visual basic 2005 that needs to call into a library written in python. The library requires python 2.6. I'm using the python C API to access the python library from the visual basic code (private declare function blah lib "python26.dll" etc). I'm doing it this way because I want to pull values out of python after the python library does its thing. Unfortunately, I get an error about the C run-time:
"R6034: An application has made an attempt to load the C runtime library incorrectly."
I think it's a conflict between MSVCR80.dll (the 2005 runtime) and MSVCR90.dll (the 2008 runtime that python 26 uses). A simple stub program written with Visual C++ 2005 that does essentially the same thing as the visual basic code also throws that error. If I compile with Visual C++ 2008 it runs fine.
So what do I do about it? I can't move away from VB, or even move to the 2008 version. I've already recompiled python 2.6 using MSVC 2005, and that wasn't enough. Do I have to track down all of the python packages the library uses and recompile those too? It seems like there must be an easier way.