Embedding a Python script engine - anybody capable of helping me through that? [Open]
-
Ok, that was useful, now I can run qmake - thanks :) . Is that supposed to be the first step? And what follows afterwards? Do I have to run a make/cmake, or should I just skip that?
EDIT:
I tried to run mingw32-make:
One of the PythonQt packages doesn't find my Python.h - is there some variable I have to set? The other package throws so many warnings and errors that the console loses track of them. Neither of them compiles.EDIT 2:
Tinkering with the *.prf files now. -
Well, that should be enough. I tried setting environment variables, changing things in the python.prf, but it got me nowhere. Even though the fatal errors for both PythonQt packages differed!
This package is far from "plug&play" and it probably won't see the support I'd prefer (I don't want to depend on dead libraries), so it probably is just a bad choice.Back to the original topic then: Integrating a Python or Lua engine manually. Still on square one with that.
-
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:
-
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?
-
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
-
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? -
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?
-
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.
-
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? -
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.
-
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.
-
The other version of PythonQt is supposedly compatible with Python 3, so I'd prefer that.