Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A error about pyuic4

Tags:

python

pyqt

pyuic

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

like image 421
kuntzuo Avatar asked Nov 19 '25 17:11

kuntzuo


1 Answers

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.

like image 94
ekhumoro Avatar answered Nov 22 '25 08:11

ekhumoro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!