Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Embedding a Python script engine - anybody capable of helping me through that? [Open]
Forum Updated to NodeBB v4.3 + New Features

Embedding a Python script engine - anybody capable of helping me through that? [Open]

Scheduled Pinned Locked Moved General and Desktop
18 Posts 2 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nibbit
    wrote on last edited by
    #9

    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.

    1. Yes, you have to set env variables. I have:
      PYTHON_PATH c:\Python26
    2. 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 :).

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thEClaw
      wrote on last edited by
      #10

      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?

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nibbit
        wrote on last edited by
        #11

        So lets change these two variables.

        Next change:
        PythonQt_QtAll.prf -> win32::LIBS += $$PWD/../lib/libPythonQt_QtAll$${DEBUG_EXT}.a

        PythonQt.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

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thEClaw
          wrote on last edited by
          #12

          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?

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nibbit
            wrote on last edited by
            #13

            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?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              thEClaw
              wrote on last edited by
              #14

              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.

              1 Reply Last reply
              0
              • T Offline
                T Offline
                thEClaw
                wrote on last edited by
                #15

                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?

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  thEClaw
                  wrote on last edited by
                  #16

                  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.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    nibbit
                    wrote on last edited by
                    #17

                    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.

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      thEClaw
                      wrote on last edited by
                      #18

                      The other version of PythonQt is supposedly compatible with Python 3, so I'd prefer that.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved