[PyQt] pylupdate4 error: Unbalanced parentheses in Python code

Paul Rouleau paul.rouleau at videotron.ca
Thu Aug 20 04:21:34 BST 2009


This is to report what looks like an error error.

I am using PyQt 4.3 on Ubuntu Hardy Heron. This is the most recent 
version of PyQt that is packaged with Hardy.


I have this error with pylupdate:


paul at ubuntu:~/Python$ pylupdate4 buggy.py -ts buggy.ts
buggy.py: Unbalanced parentheses in Python code



The file buggy.py contains this code which is a simplified sample for 
purpose of isolating the problem:

----------------Begin code
#!/usr/bin/python
# -*- coding: utf8 -*-

from PyQt4 import QtGui,  QtCore

#
# bugs when no blankline after the comment
#
enterSymbols = list( (92.5, 'Enter symbols...' , 12345, 'Ctrl+E',
                       "Enter new symbols ",
                       unicode) )
------------- end code

I am at lost at finding unbalanced parentheses there. The python 
interpreter doesn't find any either for I don't see an error message 
when I run the code.

On the other hand pylupdate4 doesn't report any error with this code:

------------ begin code
#!/usr/bin/python
# -*- coding: utf8 -*-

from PyQt4 import QtGui,  QtCore

#
# works fine when there is a blank line after the comment
#

enterSymbols = list( (92.5, 'Enter symbols...' , 12345, 'Ctrl+E',
                       "Enter new symbols ",
                       unicode) )
------------ end code


The difference between the two programs is an extra blank line between 
the comment and the assignment statement.


I have searched the archive of this mailing list for the error message 
to no avail. I verified there is nothing relevant in the Ubuntu forums 
nor in Launchpad. A Google search didn't help either.

The workaround is easy: add extra blank lines after comments when the 
next statement has parenthesis that spill over many lines. But the error 
is not reported anywhere I can think of, I felt like I should report it 
here.


More information about the PyQt mailing list