Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
Same as you, I benefit from Roman's tutorial package a lot. I was on-and-off on trying to work out a binding for more than 6 months! Thank you, Roman! When the MinGW shiboken build is ready, I'll start to move my Qt C++ application to PySide. From: sable.sourcefo...@gmail.com [mailto:sable.sourcefo...@gmail.com] On Behalf Of Sébastien Sablé Sablé Sent: Saturday, January 19, 2013 1:10 AM To: Roman Lacko Cc: ZHONG Zhu; pyside@qt-project.org Subject: Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig Many thanks Roman! I have been able to run your tutorial, and then adapt it to start binding a library on which I work. I have only binded 4 classes for the moment out of around one hundred, and that required quite a lot of trial and error, but it gets easier as I learn the typesystem syntax. That tutorial got me started and probably saved me plenty hours of setting up the project. cheers Sébastien Sablé ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
I'm glad I could help, the mingw build has still some issues to solve 2013/1/21 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Same as you, I benefit from Roman’s tutorial package a lot. I was on-and-off on trying to work out a binding for more than 6 months! Thank you, Roman! When the MinGW shiboken build is ready, I’ll start to move my Qt C++ application to PySide. ** ** *From:* sable.sourcefo...@gmail.com [mailto:sable.sourcefo...@gmail.com] *On Behalf Of *Sébastien Sablé Sablé *Sent:* Saturday, January 19, 2013 1:10 AM *To:* Roman Lacko *Cc:* ZHONG Zhu; pyside@qt-project.org *Subject:* Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig ** ** Many thanks Roman! I have been able to run your tutorial, and then adapt it to start binding a library on which I work. I have only binded 4 classes for the moment out of around one hundred, and that required quite a lot of trial and error, but it gets easier as I learn the typesystem syntax. That tutorial got me started and probably saved me plenty hours of setting up the project. cheers Sébastien Sablé ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
Many thanks Roman! I have been able to run your tutorial, and then adapt it to start binding a library on which I work. I have only binded 4 classes for the moment out of around one hundred, and that required quite a lot of trial and error, but it gets easier as I learn the typesystem syntax. That tutorial got me started and probably saved me plenty hours of setting up the project. cheers Sébastien Sablé ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
Now I have 6 files in package folder. D:\BINDINGTEST\FOOLIBBINDING\PACKAGE FooLib.dll foolib.pyd foolib_test.py libshiboken-python2.7.dll QtCore.pyd QtCore4.dll 1. Run foolib_test.py with QtCore4.dll copied from PySide 1.1.2 folder. I got below error. D:\BindingTest\FooLibBindingfoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\foolib_test.py, line 1, in module from foolib import FooClass ImportError: No module named foolib 2. Copied D:\Qt\4.8.1\bin\QtCore4.dll from my Qt 4.8.1 installation to D:\BINDINGTEST\FOOLIBBINDING\PACKAGE. Run foolib_test.py again, I got below error. D:\BindingTest\FooLibBinding\packagefoolib_test.py ImportError: could not import module 'PySide.QtCore' Fatal Python error: can't initialize module foolib This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Could you help to have a check the cause of the error message? From: Roman Lacko [mailto:backup.rla...@gmail.com] Sent: Wednesday, January 16, 2013 3:38 PM To: ZHONG Zhu Cc: pyside@qt-project.org Subject: Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig Hi, 2013/1/16 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cnmailto:zhu.zh...@alcatel-sbell.com.cn Thank you Roman, I completed all steps except for step 5. 1. Some problem found. In step 3, in FooLibBinding\FooLibBinding.pro, I should be using shiboken-python2.7.a but PySide Windows installer only installed shiboken-python2.7.lib. So I have to use MinGW to build Shiboken from source to get both libshiboken-python2.7.dll.a and libshiboken-python2.7.dll I will try to generate the .a version of shiboken-python2.7.lib so the next version of PySide package will contain both .lib and .a versions. 2. After the package been generated, I tried to run foolib_test.py but failed. Error message is like below. Then I used Dependency Walker to load foolib.pyd. It complains about QtCore4.dll. Error message is Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. I checked and looks like QtCore4.dll shipped with PySide installer is based on Qt 4.8.2 but my local Qt C++ installation is Qt 4.8.1. Could this be the reason I can't run foolib_test.py? Do I need to upgrade my Qt SDK to higher version like 4.8.4? You can try to replace Qt DLLs from PySide with version you have installed in system. I will try to regenerate the binding test with mingw... D:\BindingTest\FooLibBinding\packagefoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\package\foolib_test.py, line 1, in module from foolib import FooClass ImportError: DLL load failed: The specified procedure could not be found. === 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py From: Roman Lacko [mailto:backup.rla...@gmail.commailto:backup.rla...@gmail.com] Sent: Wednesday, January 16, 2013 12:07 AM To: ZHONG Zhu; pyside@qt-project.orgmailto:pyside@qt-project.org Subject: Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c:/Python27_64/libs/python27.lib \ ../pyside/shiboken-python2.7.lib \ ../FooLib-build-Desktop-Release/release/FooLib.lib 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com Hi, i have prepared the sample projects for you here [1] Description: This is sample demonstration how to generate simple bindings with shiboken python binding generator FooLib project contains the library for which we want to generate the bindings FooLibBinding project contains the generated binding sources Software used: Qt 4.8.4 MSVC 2010 64bit Python 2.7 64bit PySide 1.1.2 for Python 2.7 64bit To generate and test the bindigs do the following: 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
2013/1/16 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Now I have 6 files in package folder. D:\BINDINGTEST\FOOLIBBINDING\PACKAGE FooLib.dll foolib.pyd foolib_test.py libshiboken-python2.7.dll QtCore.pyd QtCore4.dll ** ** **1. **Run foolib_test.py with QtCore4.dll copied from PySide 1.1.2 folder. I got below error. ** ** D:\BindingTest\FooLibBindingfoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\foolib_test.py, line 1, in module* *** from foolib import FooClass ImportError: No module named foolib ** ** **2. **Copied D:\Qt\4.8.1\bin\QtCore4.dll from my Qt 4.8.1 installation to D:\BINDINGTEST\FOOLIBBINDING\PACKAGE. Run foolib_test.py again, I got below error. ** ** D:\BindingTest\FooLibBinding\packagefoolib_test.py ImportError: could not import module 'PySide.QtCore' Fatal Python error: can't initialize module foolib ** ** This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. ** ** Could you help to have a check the cause of the error message? I thing it's because you are using mingw and PySide was compiled with msvc. I will try to create PySide distribution with mingw, but it takes more time. Best would be if you can use msvc compiler (VS 2008/2010 Express is free). ** ** *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Wednesday, January 16, 2013 3:38 PM *To:* ZHONG Zhu *Cc:* pyside@qt-project.org *Subject:* Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig ** ** Hi, ** ** 2013/1/16 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Thank you Roman, I completed all steps except for step 5. 1. Some problem found. In step 3, in FooLibBinding\FooLibBinding.pro, I should be using shiboken-python2.7.a but PySide Windows installer only installed shiboken-python2.7.lib. So I have to use MinGW to build Shiboken from source to get both libshiboken-python2.7.dll.a and libshiboken-python2.7.dll I will try to generate the .a version of shiboken-python2.7.lib so the next version of PySide package will contain both .lib and .a versions. 2. After the “package” been generated, I tried to run foolib_test.py but failed. Error message is like below. Then I used “Dependency Walker” to load foolib.pyd. It complains about QtCore4.dll. Error message is “Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.” I checked and looks like QtCore4.dll shipped with PySide installer is based on Qt 4.8.2 but my local Qt C++ installation is Qt 4.8.1. Could this be the reason I can’t run foolib_test.py? Do I need to upgrade my Qt SDK to higher version like 4.8.4? You can try to replace Qt DLLs from PySide with version you have installed in system. I will try to regenerate the binding test with mingw... D:\BindingTest\FooLibBinding\packagefoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\package\foolib_test.py, line 1, in module from foolib import FooClass ImportError: DLL load failed: The specified procedure could not be found.* *** === 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Wednesday, January 16, 2013 12:07 AM *To:* ZHONG Zhu; pyside@qt-project.org *Subject:* Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path 2013/1/15 Roman Lacko backup.rla...@gmail.com btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c:/Python27_64/libs/python27.lib \ ../pyside/shiboken-python2.7.lib \ ../FooLib-build-Desktop-Release/release/FooLib.lib 2013/1/15 Roman Lacko backup.rla...@gmail.com Hi, i have prepared the sample projects for you here [1] Description
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
I re-installed everying: Qt 4.8.4 for VC2010+ PySide 1.1.2. Then recompiled the package following your instruction. At last, the test file foolib_test.py passed fine. That's really terrific! Thank you so much Roman! Still hope you can generate a PySide Windows installer on MinGW. From: Roman Lacko [mailto:backup.rla...@gmail.com] Sent: Wednesday, January 16, 2013 5:49 PM To: ZHONG Zhu Cc: pyside@qt-project.org Subject: Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig 2013/1/16 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cnmailto:zhu.zh...@alcatel-sbell.com.cn Now I have 6 files in package folder. D:\BINDINGTEST\FOOLIBBINDING\PACKAGE FooLib.dll foolib.pyd foolib_test.py libshiboken-python2.7.dll QtCore.pyd QtCore4.dll 1. Run foolib_test.py with QtCore4.dll copied from PySide 1.1.2 folder. I got below error. D:\BindingTest\FooLibBindingfoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\foolib_test.py, line 1, in module from foolib import FooClass ImportError: No module named foolib 2. Copied D:\Qt\4.8.1\bin\QtCore4.dll from my Qt 4.8.1 installation to D:\BINDINGTEST\FOOLIBBINDING\PACKAGE. Run foolib_test.py again, I got below error. D:\BindingTest\FooLibBinding\packagefoolib_test.py ImportError: could not import module 'PySide.QtCore' Fatal Python error: can't initialize module foolib This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Could you help to have a check the cause of the error message? I thing it's because you are using mingw and PySide was compiled with msvc. I will try to create PySide distribution with mingw, but it takes more time. Best would be if you can use msvc compiler (VS 2008/2010 Express is free). From: Roman Lacko [mailto:backup.rla...@gmail.commailto:backup.rla...@gmail.com] Sent: Wednesday, January 16, 2013 3:38 PM To: ZHONG Zhu Cc: pyside@qt-project.orgmailto:pyside@qt-project.org Subject: Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig Hi, 2013/1/16 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cnmailto:zhu.zh...@alcatel-sbell.com.cn Thank you Roman, I completed all steps except for step 5. 1. Some problem found. In step 3, in FooLibBinding\FooLibBinding.pro, I should be using shiboken-python2.7.a but PySide Windows installer only installed shiboken-python2.7.lib. So I have to use MinGW to build Shiboken from source to get both libshiboken-python2.7.dll.a and libshiboken-python2.7.dll I will try to generate the .a version of shiboken-python2.7.lib so the next version of PySide package will contain both .lib and .a versions. 2. After the package been generated, I tried to run foolib_test.py but failed. Error message is like below. Then I used Dependency Walker to load foolib.pyd. It complains about QtCore4.dll. Error message is Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. I checked and looks like QtCore4.dll shipped with PySide installer is based on Qt 4.8.2 but my local Qt C++ installation is Qt 4.8.1. Could this be the reason I can't run foolib_test.py? Do I need to upgrade my Qt SDK to higher version like 4.8.4? You can try to replace Qt DLLs from PySide with version you have installed in system. I will try to regenerate the binding test with mingw... D:\BindingTest\FooLibBinding\packagefoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\package\foolib_test.py, line 1, in module from foolib import FooClass ImportError: DLL load failed: The specified procedure could not be found. === 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py From: Roman Lacko [mailto:backup.rla...@gmail.commailto:backup.rla...@gmail.com] Sent: Wednesday, January 16, 2013 12:07 AM To: ZHONG Zhu; pyside@qt-project.orgmailto:pyside@qt-project.org Subject: Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
2013/1/17 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn I re-installed everying: Qt 4.8.4 for VC2010+ PySide 1.1.2. Then recompiled the package following your instruction. At last, the test file foolib_test.py passed fine. That’s really terrific! Thank you so much Roman! ** ** Still hope you can generate a PySide Windows installer on MinGW. I'm working on it :) ** ** *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Wednesday, January 16, 2013 5:49 PM *To:* ZHONG Zhu *Cc:* pyside@qt-project.org *Subject:* Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig ** ** 2013/1/16 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Now I have 6 files in package folder. D:\BINDINGTEST\FOOLIBBINDING\PACKAGE FooLib.dll foolib.pyd foolib_test.py libshiboken-python2.7.dll QtCore.pyd QtCore4.dll 1. Run foolib_test.py with QtCore4.dll copied from PySide 1.1.2 folder. I got below error. D:\BindingTest\FooLibBindingfoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\foolib_test.py, line 1, in module* *** from foolib import FooClass ImportError: No module named foolib 2. Copied D:\Qt\4.8.1\bin\QtCore4.dll from my Qt 4.8.1 installation to D:\BINDINGTEST\FOOLIBBINDING\PACKAGE. Run foolib_test.py again, I got below error. D:\BindingTest\FooLibBinding\packagefoolib_test.py ImportError: could not import module 'PySide.QtCore' Fatal Python error: can't initialize module foolib This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Could you help to have a check the cause of the error message? ** ** I thing it's because you are using mingw and PySide was compiled with msvc. I will try to create PySide distribution with mingw, but it takes more time. Best would be if you can use msvc compiler (VS 2008/2010 Express is free). *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Wednesday, January 16, 2013 3:38 PM *To:* ZHONG Zhu *Cc:* pyside@qt-project.org *Subject:* Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig Hi, 2013/1/16 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Thank you Roman, I completed all steps except for step 5. 1. Some problem found. In step 3, in FooLibBinding\FooLibBinding.pro, I should be using shiboken-python2.7.a but PySide Windows installer only installed shiboken-python2.7.lib. So I have to use MinGW to build Shiboken from source to get both libshiboken-python2.7.dll.a and libshiboken-python2.7.dll I will try to generate the .a version of shiboken-python2.7.lib so the next version of PySide package will contain both .lib and .a versions. 2. After the “package” been generated, I tried to run foolib_test.py but failed. Error message is like below. Then I used “Dependency Walker” to load foolib.pyd. It complains about QtCore4.dll. Error message is “Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.” I checked and looks like QtCore4.dll shipped with PySide installer is based on Qt 4.8.2 but my local Qt C++ installation is Qt 4.8.1. Could this be the reason I can’t run foolib_test.py? Do I need to upgrade my Qt SDK to higher version like 4.8.4? You can try to replace Qt DLLs from PySide with version you have installed in system. I will try to regenerate the binding test with mingw... D:\BindingTest\FooLibBinding\packagefoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\package\foolib_test.py, line 1, in module from foolib import FooClass ImportError: DLL load failed: The specified procedure could not be found.* *** === 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Wednesday, January 16, 2013 12:07 AM *To:* ZHONG Zhu; pyside@qt-project.org *Subject:* Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path 2013/1/15 Roman Lacko backup.rla...@gmail.com btw, you need to update paths to python libs
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c:/Python27_64/libs/python27.lib \ ../pyside/shiboken-python2.7.lib \ ../FooLib-build-Desktop-Release/release/FooLib.lib 2013/1/15 Roman Lacko backup.rla...@gmail.com Hi, i have prepared the sample projects for you here [1] Description: This is sample demonstration how to generate simple bindings with shiboken python binding generator FooLib project contains the library for which we want to generate the bindings FooLibBinding project contains the generated binding sources Software used: Qt 4.8.4 MSVC 2010 64bit Python 2.7 64bit PySide 1.1.2 for Python 2.7 64bit To generate and test the bindigs do the following: 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py [1] BindingTest.zip - https://docs.google.com/file/d/0B0aOk3P0ndoLbkhwbWZncTlUM00/edit 2013/1/15 Roman Lacko backup.rla...@gmail.com I will prepare simple working package for you 2013/1/15 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Thank you for your kindly reply! I was following this tutorial but just can’t build a working binding on Windows. Do you have any experience on building the binding on Windows? ** ** *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Tuesday, January 15, 2013 4:46 PM *To:* ZHONG Zhu *Subject:* Re: [PySide] PySide - Qt5 - Swig ** ** I have used this tutorial to create my first bindings: http://qt-project.org/wiki/PySide_Binding_Generation_Tutorial. it contains downloadable package with full source. regards R. ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path 2013/1/15 Roman Lacko backup.rla...@gmail.com btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c:/Python27_64/libs/python27.lib \ ../pyside/shiboken-python2.7.lib \ ../FooLib-build-Desktop-Release/release/FooLib.lib 2013/1/15 Roman Lacko backup.rla...@gmail.com Hi, i have prepared the sample projects for you here [1] Description: This is sample demonstration how to generate simple bindings with shiboken python binding generator FooLib project contains the library for which we want to generate the bindings FooLibBinding project contains the generated binding sources Software used: Qt 4.8.4 MSVC 2010 64bit Python 2.7 64bit PySide 1.1.2 for Python 2.7 64bit To generate and test the bindigs do the following: 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py [1] BindingTest.zip - https://docs.google.com/file/d/0B0aOk3P0ndoLbkhwbWZncTlUM00/edit 2013/1/15 Roman Lacko backup.rla...@gmail.com I will prepare simple working package for you 2013/1/15 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Thank you for your kindly reply! I was following this tutorial but just can’t build a working binding on Windows. Do you have any experience on building the binding on Windows? ** ** *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Tuesday, January 15, 2013 4:46 PM *To:* ZHONG Zhu *Subject:* Re: [PySide] PySide - Qt5 - Swig ** ** I have used this tutorial to create my first bindings: http://qt-project.org/wiki/PySide_Binding_Generation_Tutorial. it contains downloadable package with full source. regards R. ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
Hi Roman, I read somewhere and somebody on the mailing list told me that since Python is compiled with MSVC 2008, I need to use it to create my C++ library and PySide bindings. Is this not true? Can I use the newer versions of MSVC? Thanks, Otto From: pyside-bounces+ochiu=teslamotors@qt-project.org [mailto:pyside-bounces+ochiu=teslamotors@qt-project.org] On Behalf Of Roman Lacko Sent: Tuesday, January 15, 2013 8:07 AM To: ZHONG Zhu; pyside@qt-project.org Subject: Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c:/Python27_64/libs/python27.lib \ ../pyside/shiboken-python2.7.lib \ ../FooLib-build-Desktop-Release/release/FooLib.lib 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com Hi, i have prepared the sample projects for you here [1] Description: This is sample demonstration how to generate simple bindings with shiboken python binding generator FooLib project contains the library for which we want to generate the bindings FooLibBinding project contains the generated binding sources Software used: Qt 4.8.4 MSVC 2010 64bit Python 2.7 64bit PySide 1.1.2 for Python 2.7 64bit To generate and test the bindigs do the following: 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py [1] BindingTest.zip - https://docs.google.com/file/d/0B0aOk3P0ndoLbkhwbWZncTlUM00/edit 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com I will prepare simple working package for you 2013/1/15 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cnmailto:zhu.zh...@alcatel-sbell.com.cn Thank you for your kindly reply! I was following this tutorial but just can't build a working binding on Windows. Do you have any experience on building the binding on Windows? From: Roman Lacko [mailto:backup.rla...@gmail.commailto:backup.rla...@gmail.com] Sent: Tuesday, January 15, 2013 4:46 PM To: ZHONG Zhu Subject: Re: [PySide] PySide - Qt5 - Swig I have used this tutorial to create my first bindings: http://qt-project.org/wiki/PySide_Binding_Generation_Tutorial. it contains downloadable package with full source. regards R. ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
Otto, You are correct. Generally, you should use the same compiler (MSVC2008). Building CPython extensions with a different version of Visual Studio can lead to undesirable behaviour, simply not loading an extension module or crashing. This is because different versions of the C runtime will be loaded, and conflict. By far the most robust solution is to use MSVC2008 for everything. Regards, Simon On Tue, Jan 15, 2013 at 4:55 PM, Otto Chiu oc...@teslamotors.com wrote: Hi Roman, I read somewhere and somebody on the mailing list told me that since Python is compiled with MSVC 2008, I need to use it to create my C++ library and PySide bindings. Is this not true? Can I use the newer versions of MSVC? ** ** Thanks, Otto ** ** *From:* pyside-bounces+ochiu=teslamotors@qt-project.org [mailto: pyside-bounces+ochiu=teslamotors@qt-project.org] *On Behalf Of *Roman Lacko *Sent:* Tuesday, January 15, 2013 8:07 AM *To:* ZHONG Zhu; pyside@qt-project.org *Subject:* Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig ** ** sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ** ** ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path ** ** ** ** 2013/1/15 Roman Lacko backup.rla...@gmail.com btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c:/Python27_64/libs/python27.lib \ ../pyside/shiboken-python2.7.lib \ ../FooLib-build-Desktop-Release/release/FooLib.lib ** ** 2013/1/15 Roman Lacko backup.rla...@gmail.com Hi, i have prepared the sample projects for you here [1] Description: This is sample demonstration how to generate simple bindings with shiboken python binding generator FooLib project contains the library for which we want to generate the bindings FooLibBinding project contains the generated binding sources Software used: Qt 4.8.4 MSVC 2010 64bit Python 2.7 64bit PySide 1.1.2 for Python 2.7 64bit To generate and test the bindigs do the following: 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py [1] BindingTest.zip - https://docs.google.com/file/d/0B0aOk3P0ndoLbkhwbWZncTlUM00/edit ** ** 2013/1/15 Roman Lacko backup.rla...@gmail.com I will prepare simple working package for you ** ** 2013/1/15 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Thank you for your kindly reply! I was following this tutorial but just can’t build a working binding on Windows. Do you have any experience on building the binding on Windows? *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Tuesday, January 15, 2013 4:46 PM *To:* ZHONG Zhu *Subject:* Re: [PySide] PySide - Qt5 - Swig I have used this tutorial to create my first bindings: http://qt-project.org/wiki/PySide_Binding_Generation_Tutorial. it contains downloadable package with full source. regards R. ** ** ** ** ** ** ** ** ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside -- Simon Jagoe Enthought Ltd +44 79 312 11 506 sja...@enthought.com ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
Thank you Roman, I completed all steps except for step 5. 1. Some problem found. In step 3, in FooLibBinding\FooLibBinding.pro, I should be using shiboken-python2.7.a but PySide Windows installer only installed shiboken-python2.7.lib. So I have to use MinGW to build Shiboken from source to get both libshiboken-python2.7.dll.a and libshiboken-python2.7.dll 2. After the package been generated, I tried to run foolib_test.py but failed. Error message is like below. Then I used Dependency Walker to load foolib.pyd. It complains about QtCore4.dll. Error message is Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module. I checked and looks like QtCore4.dll shipped with PySide installer is based on Qt 4.8.2 but my local Qt C++ installation is Qt 4.8.1. Could this be the reason I can't run foolib_test.py? Do I need to upgrade my Qt SDK to higher version like 4.8.4? D:\BindingTest\FooLibBinding\packagefoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\package\foolib_test.py, line 1, in module from foolib import FooClass ImportError: DLL load failed: The specified procedure could not be found. === 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py From: Roman Lacko [mailto:backup.rla...@gmail.com] Sent: Wednesday, January 16, 2013 12:07 AM To: ZHONG Zhu; pyside@qt-project.org Subject: Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c:/Python27_64/libs/python27.lib \ ../pyside/shiboken-python2.7.lib \ ../FooLib-build-Desktop-Release/release/FooLib.lib 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com Hi, i have prepared the sample projects for you here [1] Description: This is sample demonstration how to generate simple bindings with shiboken python binding generator FooLib project contains the library for which we want to generate the bindings FooLibBinding project contains the generated binding sources Software used: Qt 4.8.4 MSVC 2010 64bit Python 2.7 64bit PySide 1.1.2 for Python 2.7 64bit To generate and test the bindigs do the following: 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py [1] BindingTest.zip - https://docs.google.com/file/d/0B0aOk3P0ndoLbkhwbWZncTlUM00/edit 2013/1/15 Roman Lacko backup.rla...@gmail.commailto:backup.rla...@gmail.com I will prepare simple working package for you 2013/1/15 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cnmailto:zhu.zh...@alcatel-sbell.com.cn Thank you for your kindly reply! I was following this tutorial but just can't build a working binding on Windows. Do you have any experience on building the binding on Windows? From: Roman Lacko [mailto:backup.rla...@gmail.commailto:backup.rla...@gmail.com] Sent: Tuesday, January 15, 2013 4:46 PM To: ZHONG Zhu Subject: Re: [PySide] PySide - Qt5 - Swig I have used this tutorial to create my first bindings: http://qt-project.org/wiki/PySide_Binding_Generation_Tutorial. it contains downloadable package with full source. regards R. ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside
Re: [PySide] Simple shiboken binding tutorial -- was PySide - Qt5 - Swig
Hi, 2013/1/16 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Thank you Roman, I completed all steps except for step 5. **1. **Some problem found. In step 3, in FooLibBinding\FooLibBinding.pro, I should be using shiboken-python2.7.a but PySide Windows installer only installed shiboken-python2.7.lib. So I have to use MinGW to build Shiboken from source to get both libshiboken-python2.7.dll.a and libshiboken-python2.7.dll I will try to generate the .a version of shiboken-python2.7.lib so the next version of PySide package will contain both .lib and .a versions. **2. **After the “package” been generated, I tried to run foolib_test.py but failed. Error message is like below. Then I used “Dependency Walker” to load foolib.pyd. It complains about QtCore4.dll. Error message is “Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.” I checked and looks like QtCore4.dll shipped with PySide installer is based on Qt 4.8.2 but my local Qt C++ installation is Qt 4.8.1. Could this be the reason I can’t run foolib_test.py? Do I need to upgrade my Qt SDK to higher version like 4.8.4? ** You can try to replace Qt DLLs from PySide with version you have installed in system. I will try to regenerate the binding test with mingw... ** D:\BindingTest\FooLibBinding\packagefoolib_test.py Traceback (most recent call last): File D:\BindingTest\FooLibBinding\package\foolib_test.py, line 1, in module from foolib import FooClass ImportError: DLL load failed: The specified procedure could not be found.* *** === 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py ** ** *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Wednesday, January 16, 2013 12:07 AM *To:* ZHONG Zhu; pyside@qt-project.org *Subject:* Re: Simple shiboken binding tutorial -- was PySide - Qt5 - Swig ** ** sorri, you also have to update the path where you have installed Qt on your system in files: pyside\include\PySide\pyside_global.h FooLib\generate_binding.bat ** ** ...replace this c:\Qt\qt-4.8.4-msvc2010-x64 with your path ** ** ** ** 2013/1/15 Roman Lacko backup.rla...@gmail.com btw, you need to update paths to python libs and includes in FooLibBinding\FooLibBinding.pro. I have installed python in c:\Python27_64. Also if you are using mingw, you will need to change the .lib extension to .a INCLUDEPATH += ../pyside/include/PySide \ ../pyside/include/PySide/QtCore \ ../pyside/include/shiboken \ c:/Python27_64/include \ ../FooLib LIBS += c:/Python27_64/libs/python27.lib \ ../pyside/shiboken-python2.7.lib \ ../FooLib-build-Desktop-Release/release/FooLib.lib ** ** 2013/1/15 Roman Lacko backup.rla...@gmail.com Hi, i have prepared the sample projects for you here [1] Description: This is sample demonstration how to generate simple bindings with shiboken python binding generator FooLib project contains the library for which we want to generate the bindings FooLibBinding project contains the generated binding sources Software used: Qt 4.8.4 MSVC 2010 64bit Python 2.7 64bit PySide 1.1.2 for Python 2.7 64bit To generate and test the bindigs do the following: 1. Install PySide 2. Copy content of c:\Python27\Lib\site-packages\PySide to BindingTest\PySide folder 1. Compile FooLib project 2. Run FooLib\generate_binding.bat 3. Compile FooLibBinding project 4. Run FooLibBinding\make_package.bat 5. Go to generated folder package and run foolib_test.py [1] BindingTest.zip - https://docs.google.com/file/d/0B0aOk3P0ndoLbkhwbWZncTlUM00/edit ** ** 2013/1/15 Roman Lacko backup.rla...@gmail.com I will prepare simple working package for you ** ** 2013/1/15 ZHONG Zhu zhu.zh...@alcatel-sbell.com.cn Thank you for your kindly reply! I was following this tutorial but just can’t build a working binding on Windows. Do you have any experience on building the binding on Windows? *From:* Roman Lacko [mailto:backup.rla...@gmail.com] *Sent:* Tuesday, January 15, 2013 4:46 PM *To:* ZHONG Zhu *Subject:* Re: [PySide] PySide - Qt5 - Swig I have used this tutorial to create my first bindings: http://qt-project.org/wiki/PySide_Binding_Generation_Tutorial. it contains downloadable package with full source. regards R. ** ** ** ** ** ** ** ** ___ PySide mailing list PySide@qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside