[PyKDE] function name collision

Fábio Sato sato at simepar.br
Wed Jul 23 22:41:00 BST 2003


No, I don't have any wigdet called 'string'... :(
Here is the result of a 'grep string' in my source code:

import string
from string import *
        idx = string.find(self.lineEdit1, ":")

Thanks!
-- 
Fábio Sato

> Do you happened to have a widget in the call chain called 'string'? If so,
> until it does out of scope, string no longer refers to the string module
> but rather to your QWidget instance called string.
>
> --mike
>
> -----Original Message-----
> From: Fábio Sato [mailto:sato at simepar.br]
> Sent: Wednesday, July 23, 2003 1:06 PM
> To: pykde at mats.imk.fraunhofer.de
> Subject: [PyKDE] function name collision
>
>
> I've just started to program in Python and I'm trying to create a small GUI
> software using PyQt.
>
> However I'm having an odd error that I don't know how to solve.
>
> The problem is occurring is this line of my code:
>  idx = string.find(self.lineEdit1, ":")
>
> It issues an error that seems to be a "function name collision" of the
> find()
> function of the Python's string module and the find() function of the
> QWidget
> class:
>
> Traceback (most recent call last):
> >  File "./accel.py", line 105, in startDownload
> >    idx = string.find(self.lineEdit1, ":")
> >  File "/usr/lib/python2.2/string.py", line 174, in find
> >    return s.find(*args)
> >TypeError: Argument 1 of QWidget.find() has an invalid type
>
> I'm importing the modules in the following way:
>
> import sys
> from qt import QApplication, QMainWindow, QLabel, QPushButton, QRect,
> QLineEdit, QSpinBox, QProgressBar, QSizePolicy, SIGNAL, SLOT, QSize, Qt
> from qttable import QTable
> import string
> from string import *
>
>
> Does anyone knows how to solve this?
>
> Thanks!

-- 
Fábio Sato




More information about the PyQt mailing list