Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Pyd cannot be imported, using shiboken6 to bind

Pyd cannot be imported, using shiboken6 to bind

Scheduled Pinned Locked Moved Solved Language Bindings
shibokenqt6bindingpyside6c++
4 Posts 2 Posters 2.5k Views
  • 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.
  • Cr0ssC Offline
    Cr0ssC Offline
    Cr0ss
    wrote on last edited by Cr0ss
    #1

    I'm trying to build widgetbinding from pyside's examples (At D:\Python\Python39\Lib\site-packages\PySide6\examples\widgetbinding) . I successfully built the module pyd but I cannot import the module after building the pyd. I got ImportError when import wiggly in python.

    how I built the pyd:

    cmake -B ./build -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release
    cd build
    nmake
    nmake install
    cd .. # back to the directory my pyd installed
    ipython # start testing the importing
    
    In [1]: import wiggly
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-1-8a2812855881> in <module>
    ----> 1 import wiggly
    
    ImportError: DLL load failed while importing wiggly: 找不到指定的模块。
    

    (ImportError: DLL load failed while importing wiggly: The specified module could not be found.)


    I think I've already have the dlls needed:

    widgetbinding
     ├── bindings.h
     ├── bindings.xml
     ├── build
     ├── CMakeLists.txt
     ├── dialog.py
     ├── libwiggly.dll
     ├── macros.h
     ├── main.py
     ├── README.md
     ├── shiboken6.abi3.dll
     ├── wiggly.pyd
     ├── wigglywidget.cpp
     ├── wigglywidget.h
     ├── wigglywidget.py
     └── __pycache__
    

    another example: samplebinding (also from pyside6's examples) can be successfully built and be imported
    cf93b6b1-619c-4309-abd2-8a7573ccdc2f-image.png

    I also tried my own C++ Qt library and got the same import error.

    My development environment

    Python3.9.2 (MSC v.1928 64 bit)
    Qt 6.0.2
    PySide 6.0.2 (I tried on PySide and Shiboken 6.0.1 version too)
    Shiboken6.0.2
    Using built in nmake tool from vs 2019

    Is it a bug? If not, what should I do to be able to use shiboken binded C++ Qt libraries in python?

    1 Reply Last reply
    0
    • SGaistS SGaist

      Hi and welcome to devnet,

      I can't answer that question directly but things that comes to mind:

      • where is the dll installed ?
      • if you use a tool like Dependency Walker, does the dll find its dependencies ?
      Cr0ssC Offline
      Cr0ssC Offline
      Cr0ss
      wrote on last edited by
      #4

      Hi @SGaist, I took you advice and finally found out where the problem is.
      I looked into Wependency Walker and realized that I can import PySide6.QWidgets before I import wiggly, So that the dlls needed is already loaded for wiggly.
      I've been testing wiggly using one single import wiggly in IPython, not runing the main.py directly in the examples, trying to copy dlls from one place to another, and kept getting ImportErrors.
      Now I write:

      import PySide6.QtWidget
      import wiggly
      

      and it works.

      Thanks for your help!

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to devnet,

        I can't answer that question directly but things that comes to mind:

        • where is the dll installed ?
        • if you use a tool like Dependency Walker, does the dll find its dependencies ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        Cr0ssC 1 Reply Last reply
        0
        • Cr0ssC Offline
          Cr0ssC Offline
          Cr0ss
          wrote on last edited by
          #3
          This post is deleted!
          1 Reply Last reply
          0
          • SGaistS SGaist

            Hi and welcome to devnet,

            I can't answer that question directly but things that comes to mind:

            • where is the dll installed ?
            • if you use a tool like Dependency Walker, does the dll find its dependencies ?
            Cr0ssC Offline
            Cr0ssC Offline
            Cr0ss
            wrote on last edited by
            #4

            Hi @SGaist, I took you advice and finally found out where the problem is.
            I looked into Wependency Walker and realized that I can import PySide6.QWidgets before I import wiggly, So that the dlls needed is already loaded for wiggly.
            I've been testing wiggly using one single import wiggly in IPython, not runing the main.py directly in the examples, trying to copy dlls from one place to another, and kept getting ImportErrors.
            Now I write:

            import PySide6.QtWidget
            import wiggly
            

            and it works.

            Thanks for your help!

            1 Reply Last reply
            1

            • Login

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