3

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

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
kuntzuo
  • 43
  • 4
  • I'm seeing the same strange error, also with fedora 16. Somehow the pyuic directory (and possibly others?) didn't install properly. Somehow the contents of pyuic.py is replaced with the shell script seen above. That means the shell script is essentially pointing to itself! It would be infinite recursion, but it just crashes instead because a shell script isn't valid python syntax. Anyone know what causes this? – Stuart Berg May 24 '12 at 03:33
  • @superbatfish. Surely it's no coincidence that both you and the OP are using fedora 16? Maybe you should trying posting a report on fedora's bug tracker. – ekhumoro May 25 '12 at 17:35

2 Answers2

1

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.

ekhumoro
  • 115,249
  • 20
  • 229
  • 336
0

If you want use python2, just type

python2-pyuic4 main.ui > main_ui.py
Thirumalai murugan
  • 5,698
  • 8
  • 32
  • 54