AW: need help with generating python bindings

Marian Thomsen marian.th at outlook.de
Fri Apr 23 07:41:04 BST 2021


Hello,

I have not used sip in combination with qt before so correct me if I'm wrong.

I assume you are using this demo https://docs.huihoo.com/pyqt/sip4/using.html#a-more-complex-c-example ?

This demo uses sip v4.

One possibility is to use the old qt and sip version specified in the demo.

If this is not possible ...

With sip v5 a lot changed in the build process. Therefore the package project example could help:
https://www.riverbankcomputing.com/static/Docs/sip/examples.html#package-projects

You have to specify the %Import in the pyproject.toml file under'requires-dist' and if the location is not found it has to be specified with 'sip-include-dirs'.
I'm not sure how one would do the package organisation exaclty. My guess is one would either append hello.sip example to the existing top-level qt package of  QtCoremod.sip or create an own top-level package e.g. demo.sip and append hello.sip to that.

Hope this helps.

Regards

M.T.
________________________________
Von: Suman Chatterjee <sum_chat at hotmail.com>
Gesendet: Freitag, 23. April 2021 02:10
An: pyqt at riverbankcomputing.com <pyqt at riverbankcomputing.com>
Betreff: need help with generating python bindings

Hi,
I am following the hello demo to create python bindings using sip. I have installed PyQt5-5.15.4, sip-6.0.3 as below


Requirement already satisfied: toml in /usr/local/lib/python3.9/site-packages (from sip) (0.10.2)

Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.9/site-packages (from packaging->sip) (2.4.7)

Installing collected packages: sip, PyQt5

Successfully installed PyQt5-5.15.4 sip-6.0.3

I also wrote the hello.sip file as below

%Module(name=hello, language="C")
%Import QtCore/QtCoremod.sip
class Hello : QLabel {
%TypeHeaderCode
#include <hello.h>
%End
......

Then when I run sip-install it throws me the below error .


VVVV:sip XXXXXX$ sip-install

These bindings will be built: hello.

Generating the hello bindings...

sip-install: Unable to find file "QtCore/QtCoremod.sip"


But I verified the file exists in the path
usr⁩ ▸ ⁨local⁩ ▸ ⁨lib⁩ ▸ ⁨python3.9⁩ ▸ ⁨site-packages⁩ ▸ ⁨PyQt5⁩ ▸ ⁨bindings⁩ ▸ ⁨QtCore⁩


So how do I point to that bindings folder. I tried exporting that Path in my bash_profile. But it did not help.

I will really appreciate if anyone can please help me out
Thank You,
Suman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210423/44060ae3/attachment.htm>


More information about the PyQt mailing list