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. Qt use python function return load error
Forum Updated to NodeBB v4.3 + New Features

Qt use python function return load error

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 546 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.
  • L Offline
    L Offline
    lee64456546
    wrote on last edited by
    #1

    I am using QT to call a python function. But the
    PyObject* pFunc = PyObject_GetAttrString(pModule, "hello");
    if(!pFunc)
    {
    qDebug() << "GetFunc failed";
    }

    pFunc pointer is NULL, can any help ? thanks.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Try to call
      PyObject_HasAttrString
      and see what it says.

      L 1 Reply Last reply
      0
      • L Offline
        L Offline
        lee64456546
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          Try to call
          PyObject_HasAttrString
          and see what it says.

          L Offline
          L Offline
          lee64456546
          wrote on last edited by
          #4

          @mrjj It returns 0 , but the .py file is simple
          def hello():
          print("hello world from python");

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            Is the py file named test ?
            https://stackoverflow.com/questions/24313681/pyobject-getattrstring-c-function-returning-null-unable-to-call-python-functi

            L 2 Replies Last reply
            2
            • mrjjM mrjj

              Hi
              Is the py file named test ?
              https://stackoverflow.com/questions/24313681/pyobject-getattrstring-c-function-returning-null-unable-to-call-python-functi

              L Offline
              L Offline
              lee64456546
              wrote on last edited by
              #6

              @mrjj yes

              1 Reply Last reply
              0
              • mrjjM mrjj

                Hi
                Is the py file named test ?
                https://stackoverflow.com/questions/24313681/pyobject-getattrstring-c-function-returning-null-unable-to-call-python-functi

                L Offline
                L Offline
                lee64456546
                wrote on last edited by
                #7

                @mrjj Solved after i renamed the test.py file...

                mrjjM 1 Reply Last reply
                1
                • L lee64456546

                  @mrjj Solved after i renamed the test.py file...

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @lee64456546
                  Very bizarre :)

                  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