Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1994

shiboken6-genpyi has several import errors

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.5.0, 6.4.3
    • 6.3.1
    • Shiboken
    • None
    • Python 3.9.6 on Windows 10.
      PySide6==6.3.1
      shiboken6==6.3.1
    • Windows
    • c8b8d0868 (dev), 3d9bc9fb2 (6.4), ee35c071e (dev), a744bf5a7 (6.4)

    Description

      First of all, thanks for making the *pyi tool available for other bindings!

      I have been trying to use it, but it wasn't so straight forward.

      First I tried it on the the example "samplebinding". There it ran into the first error:

      pyside-pyside-setup\examples\samplebinding>shiboken6-genpyi Universe.pyd
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "shibokensupport/signature/lib/pyi_generator.py", line 342, in main
        File "shibokensupport/signature/lib/pyi_generator.py", line 287, in generate_pyi
        File "shibokensupport/signature/lib/pyi_generator.py", line 193, in find_imports
      NameError: name 'PySide6' is not defined
      

      I then copied the script from "pyside-pyside-setup\sources\shiboken6\shibokenmodule\files.dir\shibokensupport\signature\lib\pyi_generator.py". This one gave a more detailed error message:

      ...
        File "pyside-pyside-setup\examples\samplebinding\pyi_generator.py", line 156, in find_imports
          return [imp for imp in PySide6.__all__ if f"PySide6.{imp}." in text]
      NameError: name 'PySide6' is not defined
      

      It looks like the script depends itself on PySide6. I added "import PySide6" on the top and this time the script ran.

      Then I tried it then on the "widgetbinding" example, with the additional import. Again an error:

      pyside-pyside-setup\examples\widgetbinding>python pyi_generator.py wiggly.pyd
      Traceback (most recent call last):
        File "pyside-pyside-setup\examples\widgetbinding\pyi_generator.py", line 310, in <module>
          main()
        File "pyside-pyside-setup\examples\widgetbinding\pyi_generator.py", line 307, in main
          generate_pyi(module, outpath, options=options)
        File "pyside-pyside-setup\examples\widgetbinding\pyi_generator.py", line 214, in generate_pyi
          import_name, plainname, outfilepath = find_module(import_name, outpath, options._pyside_call)
        File "pyside-pyside-setup\examples\widgetbinding\pyi_generator.py", line 205, in find_module
          __import__(plainname)
      ImportError: DLL load failed while importing wiggly: The specified module could not be found.
      

      Looks like is also not finding the PySide DLLs. I then added "import PySide6.QtWidgets" to
      "pyi_generator.py" and finally it works.

      Am I missing something, or is this a bug?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ctismer Christian Tismer
            brugger Christian Brugger
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes