Embedding a Python script engine - anybody capable of helping me through that? [Open]
-
wrote on 3 Sept 2013, 12:08 last edited by
You discourage quickly :). Maybe this is far from "plug&play" but this is LGPL. Additionally you are using MinGW when author prepare project for VC.
- Yes, you have to set env variables. I have:
PYTHON_PATH c:\Python26 - You have to set proper version in prf files:
win32:PYTHON_VERSION=26
Addionally you have to change extensions in two prf file from '.lib' to '.a' and when these files will be builded then you have to put them in proper lib directory. So there is a bit of work. I can't help any more if you prefer other libs :).
- Yes, you have to set env variables. I have:
-
wrote on 3 Sept 2013, 12:13 last edited by
As I said: I have been trying to tackle this for several weeks! I don't discourage quickly, but why is there no documentation/instructions on this? It always says "it's simple, just follow these three steps", but should you run into trouble, you are left alone.
I knew about the two environment variables you mentioned, they are described "here":http://pythonqt.sourceforge.net/Building.html .
I will try again...
EDIT: How do I know which extensions I have to change? Did you mean physical files or a path inside some .prf?
-
wrote on 3 Sept 2013, 12:27 last edited by
So lets change these two variables.
Next change:
PythonQt_QtAll.prf -> win32::LIBS += $$PWD/../lib/libPythonQt_QtAll$${DEBUG_EXT}.aPythonQt.prf -> win32::LIBS += $$PWD/../lib/libPythonQt$${DEBUG_EXT}.a
This is because MinGW generate 'a' static libraries. If you will encout linker error with 'libPythonQt.a doesnt exist' then copy it from build dir to pythonqt\lib dir
-
wrote on 3 Sept 2013, 12:59 last edited by
I redownloaded Python (3.3.2), to be sure that's not causing errors. Double-checked every directory that's mentioned in the .prf-files.
Then I deleted the PythonQt directory and extracted a new one. Changed the three .prf-files, ran qmake (without any errors or warnings this time!), and eventually tried to compile everything (using "mingw32-make"), but it still didn't work. Did I miss anything?Prominent error while trying to compile was "base operand of '->' has non-pointer type ..."
Am I missing some headers or even more environment variables? -
wrote on 3 Sept 2013, 13:04 last edited by
Was you trying to run one of example projects? For ex. PyScriptEditor?
Btw I am not sure is python3.x ported to this library.
bq. but it still didn’t work.
What do you mean?
-
wrote on 3 Sept 2013, 13:07 last edited by
Compilation failed due to lots of errors - "x was not declared in this scope", "x is of non-pointer type" etc. I am probably missing some include/lib.
Which version of Python did you have success with? The one from the git repository is supposed to work with version 3.
EDIT: Just tried the repository version with Python 2.7.5 and got exactly the same errors when trying to compile.
EDIT2: The other version did indeed compile with Python 2.7.5! And I was able to run some of the examples, PyGettingStarted and NicePyConsole.
I'll try to find out what to do next. But I'd still be interested in at least knowing about how much work it would be to incorporate a basic scripting engine into my application without the use of any "man in the middle".
So far: Huge thank you. I am not yet comfortable with this, but at least something finally worked.
-
wrote on 3 Sept 2013, 20:22 last edited by
Still trying to compile PythonQt!
I finally managed to catch one of the error-message I get:bq. parser\binder.cpp:810:17: error: base operand of '->' has non-pointer type 'MemberModelItem {aka CodeModelPointer<_MemberModelItem>}'
item->setAuto(true);I get about a million of these, all in binder.cpp and all related to objects that seem like they should be pointers, but somehow they aren't recognized as such.
Does anybody see what's wrong here? -
wrote on 3 Sept 2013, 22:05 last edited by
I added a detailed description of the errors during compilation as well as small parts of the code "in a new thread":http://qt-project.org/forums/viewthread/32130/ , hoping that somebody can help.
-
wrote on 4 Sept 2013, 07:02 last edited by
bq. EDIT2: The other version did indeed compile with Python 2.7.5! And I was able to run some of the examples, PyGettingStarted and NicePyConsole.
I don't understand. If you compiled and run these examples then you have success. Them uses two dll's generated by PythonQt project: PythonQt_QtAll.dll and PythonQt.dll . These files and (libPythonQt_QtAll.a and libPythonQt.a) are all what you need.
-
wrote on 4 Sept 2013, 07:12 last edited by
The other version of PythonQt is supposedly compatible with Python 3, so I'd prefer that.
18/18