Error importing PyQt4.QtCore - python

I've been trying to get some GUI apps based on PyQt to run.
Somewhere in the PPython scripts is the following import:
from PyQt4.QtCore import *
This is the error that I keep getting consistently.
RuntimeError: the sip module implements API v8.0 to v8.1 but the PyQt4.QtCore module requires API v7.1
Why is this happening? How do I get sip to use the right API?
Thanks

Related

PyKDE: Migrating from PyQt4 to PyQt5

I am new to PyQt and am currently working on a project which is was written in PyQt4. I need to update it to PyQt5 and have done most of it. However, when it comes to PyKDE, it generates the following error:
from PyKDE4.kdeui import KVBox, KHBox, KColorButton
RuntimeError: the PyQt4.QtCore and PyQt5.QtCore modules both wrap the QObject class
The code line using PyKDE4 is:
from PyKDE4.kdeui import KVBox, KHBox, KColorButton
Basically most of the code is already in PyQt5, but I haven't found a translation for PyKDE4. Anyone can help?

I am working on getting google contacts using google contacts API . Here I am getting some problem

For running google contacts API, these libraries are used:
import atom.data
import gdata.data
import gdata.contacts.client
import gdata.contacts.data
The problem is these libraries are not installed correctly.
I am getting these type of errors.
1) AttributeError: module 'atom' has no attribute 'LinkFinder'
2) ImportError: No module named core
Any solution for doing this importing the libraries correctly?
How to install these library correctly to execute my code?
EDIT
I want to know how to remove these errors after installing atom and gdata.

'PyQt4 module not found' - Cannot use PyQt to open a GUI

I am very new to using PyQt4. So far, i have used QtDesigner to create the GUI windows i shall be using for my program.
However, when i run the first bit of python coding to get the user interface to appear, i get an error i cannot find a solution to.
Here's the code:
import sys, os
from PyQt4 import QtCore, QtGui, uic
form_class = uic.loadUiType("HomeScreen.ui") [0]
All i am trying to do with this is to load a GUI, which is called 'HomeScreen.ui'.
Upon running this code, the python shell returns an error saying:
from PyQt4 import QtCore, QtGui, uic
ImportError: No module named 'PyQt4'
I have Python 3.5 installed, as well as PyQt v4.11.4 and PyQt5.6.
'QtGui' and 'QtCore' are both saved in a folder called PyQt4 (and PyQt5), which are both stored in the path:
C:\Program Files (x86)\Python\Python35-32\Lib\site-packages
I believe this is where third party modules are supposed to be stored, but python can never find the module and i repeatedly get the same error message.
Any help would be appreciated.
I also work in windows and python 3,just run the execute file to install pyqt:
https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.6/
it works well in my environment

importing local installation of PySide into Python

Have been searching for this for a while and trying different solutions, but nothing seems to fix my problem.
I am sitting on a unix server, and have installed PySide locally in my home directory, so python will not pick it up. (not added to PYTHONPATH?).
I am not able to import PySide in my python script.
Trying the following:
import sys
sys.path.append('~/PySide-1.2.4/pyside_build/py2.7-qt4.8.5-64bit-release/pyside/PySide/')
from PySide.QtCore import *
from PySide.QtGui import *
Not sure if I am appending the correct path. At least there is a init.py file there and QtCore.so, and other *.so files.
Is it still correct to import from PySide?

Make a python program with PySide an executable

I have a python program:
import sys
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import *
app = QApplication(sys.argv)
web = QWebView()
web.load(QUrl("htpp://www.google.com"))
web.show()
web.resize(650, 750)
web.setWindowTitle('Website')
sys.exit(app.exec_())
I used google.com just for example. But if i want to make an executable of this program with py2exe but it wont work. I get this error:
With other programs without PySide it does work. But with PySide it doesnt. How can I make it work?
You need Microsoft Visual C runtime.
You should take a look at this: http://qt-project.org/wiki/Packaging_PySide_applications_on_Windows . In the py2exe tutorial it explains about the runtime you should install.
You are missing a DLL. The DLL in question can be (at least formerly) obtained from Microsoft by downloading their free compiler package.
Alternatively, ensure that this process has the right paths set to find the DLL in question.

Categories