Reputation: 43
I'm trying to transform my ui file to .py file, but when I run pyuic4 in the shell, I get an error:
# pyuic4 main.ui > main_ui.py
File "/usr/lib/python2.7/site-packages/PyQt4/uic/pyuic.py", line 2
exec /usr/bin/python /usr/lib/python2.7/site-packages/PyQt4/uic/pyuic.py ${1+"$@"}
^
SyntaxError: invalid syntax
my os is fedora16
Upvotes: 3
Views: 1973
Reputation: 1
If you want use python2, just type
python2-pyuic4 main.ui > main_ui.py
Upvotes: 0
Reputation: 120598
On Linux, pyuic4
should be a bash script that would usually be installed as /usr/bin/pyuic4
.
The error
exec /usr/bin/python /usr/lib/python2.7/site-packages/PyQt4/uic/pyuic.py ${1+"$@"}
^
SyntaxError: invalid syntax
would be produced if you attempted to run that bash script with python.
However, the error message also gives the source file location as
File "/usr/lib/python2.7/site-packages/PyQt4/uic/pyuic.py", line 2
which doesn't make much sense, because that should be a python script.
Has /usr/lib/python2.7/site-packages/PyQt4/uic/pyuic.py
somehow been over-written with the bash script?
Try opening that file, and also /usr/bin/pyuic4
, in an editor to see what they contain.
Upvotes: 1