pyuic4 Import error - python-3.x

I'm using PyQt-Py3.3-x64-gbl-4.9.5-1 package on a Windows7 64bit machine. I'm just trying to get start with PyQt so just created a simply window but when I execute the command to create the code I get this error. Any help will be appreciated.
c:\Python33\Lib\site-packages\PyQt4>pyuic4 -o FirstApp.py -x FirstApp.ui
Traceback (most recent call last):
File "C:\Python33\Lib\site-packages\PyQt4\uic\pyuic.py", line 31, in <module> from PyQt4 import QtCore
ImportError: DLL load failed: %1 is not a valid Win32 application.

Usage from the command line is(from my machine):
C:\Python27\Lib\site-packages\PyQt4>pyuic4.bat inputfile.ui > output.py
After the above step add these lines in your output.py file
if __name__=='__main__':
import sys
app=QtGui.QApplication(sys.argv)
Form=QtGui.QWidget()
ui=Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())

Related

Systrace by Command Line error

i am trying to use of systrace. for this, i am reading official site.
but after run this command on terminal :
D:\Software\Android\android-sdk\platform-tools\systrace>python systrace.py --time=10 -o mynewtrace.html sched gfx view wm
I got these error:
Traceback (most recent call last):
File "systrace.py", line 48, in <module>
from systrace import run_systrace
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 40, in <module>
from devil import devil_env
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\devil_env.py", line 32, in <module>
import dependency_manager # pylint: disable=import-error
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\__init__.py", line 28, in <module>
from .archive_info import ArchiveInfo
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\archive_info.py", line 7, in <module>
from dependency_manager import exceptions
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\exceptions.py", line 5, in <module>
from py_utils import cloud_storage
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\common\py_utils\py_utils\cloud_storage.py", line 20, in <module>
from py_utils import lock
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\common\py_utils\py_utils\lock.py", line 18, in <module>
import win32con # pylint: disable=import-error
ImportError: No module named win32con
my python version:
D:\Software\Android\android-sdk\platform-tools\systrace>python --version
Python 2.7.13
D:\Software\Android\android-sdk\platform-tools\systrace>
I have added python PATH to ** system ENVIRONMENT** . my main goal of use Systrace by command is using of Tracing Application Code. I put:
Trace.beginSection("MyAdapter.onCreateViewHolder");
and
Trace.endSection();
to my code and i want to see this output as a trace to systrace by -a or --app= options.
GUI systrace is ok on google chrome and work excellent in this browser.
python doesn't come with pywin32 library. you just need to download pywin32 version according to your system from here https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/ and install it. It will work.
For me, running
pip install pypiwin32
fixed the problem
My error stacktrace
C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace>python
systrace.py --time=10 -o my_systrace.html Traceback (most recent call
last): File "systrace.py", line 48, in <module>
from systrace import run_systrace File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py",
line 43, in <module>
from systrace import systrace_runner File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\systrace_runner.py",
line 11, in <module>
from systrace import output_generator File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\output_generator.py",
line 15, in <module>
from tracing.trace_data import trace_data File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\tracing\tracing\trace_data\trace_data.py",
line 17, in <module>
import six ImportError: No module named six
I solved the problem:
pip install six
summary
find ImportError what, use pip install it
In Windows10 when running through the command line, I got the same errors!
But if run systrace from Android Device Monitor all work fine!
To do this:
run Android Device Monitor
click DDMS icon
in the "Devices" tab select your device
click "Capture system wide trace using Android systrace" (Near the icon " Screen Capture")
I use Android Device Monitor Version: 25.2.2
In my case I was using Python 3.8, I just switched to 2.7.

PyQt5 import Error

I am trying to create a GUI that I can all it from the terminal (Ubuntu here). The problem is, whenever I try to run the code from the terminal, I get the following message:
Traceback (most recent call last):
File "alert.pyw", line 3, in <module>
from PyQt5.QtCore import *
ImportError: No module named 'PyQt5'
The problem is: I only get this message when I try to call the program from the terminal using
python3 alert.pyw Hello
PyQt5 is installed and when I import it from the shell it (apparently) works fine...

ImportError pyramid hello world program

source code:
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
def hello_world(request):
return Response('<h1>Hello world!</h1>')
if __name__ == '__main__':
config = Configurator()
config.add_view(hello_world)
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
When I ran the sample hello_world program using pyramid, I got the following error.
Traceback (most recent call last):
File "application.py", line 2, in <module>
from pyramid.config import Configurator
File "/usr/local/lib/python2.7/dist-packages/pyramid/config/__init__.py", line 12, in <module>
from pyramid.interfaces import (
File "/usr/local/lib/python2.7/dist-packages/pyramid/interfaces.py", line 3, in <module>
from zope.interface import (
ImportError: No module named interface
You've installed something improperly - more than likely by using python setup.py develop somewhere instead of using pip install -e .. If you mix tools you're going to have some issues. This particular one seems to be due to namespace packages not being configured correctly which almost always is a symptom of using easy_install and pip in the same environment. You need to pick one (preferably pip), and sometimes the decision about which one to use was already made by whatever tool installed python for you.

ImportError: libQt5WebKitWidgets.so.5: cannot open shared object file: No such file or directory

Hi I am trying to work with pyqt5 on python 3.
When I import QWebPage and QWebView from PyQt5QtWebKitWidgets
I get error
from PyQt5.QtWebKitWidgets import QWebPage, QWebView
Error is:
Traceback (most recent call last):
File "fancybrowser.py", line 49, in <module>
from PyQt5.QtWebKitWidgets import QWebPage, QWebView
ImportError: libQt5WebKitWidgets.so.5: cannot open shared object file: No such file or directory
I am on arch linux and using i3 window manager.
Previously it was working at the time when I was on GNOME.
I dont know but may be it has to do something with it.
Also I followed this link:
https://bbs.archlinux.org/viewtopic.php?pid=1655833#p1655833
but it doesnot help me too.
Plese help me to solve this.

import tkinter yields error

Starting the Open Book on Python 3.1
import turtle #this yields an error from importing tkinter
Script:
import tkinter
exit()
Yields:
Traceback (most recent call last):
File "imptk.py", line 1, in <module>
import tkinter
File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/tkinter/__init__.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_tkinter.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/lib-dynload/_tkinter.so: mach-o, but wrong architecture
Any suggestions?
Your Python is incorrectly installed, the library in question has been compiled for the wrong architecture, maybe the wrong processor or for 32 bit when it should have been 64, or similar. In any case this is not a programming error.

Resources