Why 'unbound method' error?
I've just modified a python product and I've started getting an error that doesn't make sense to me. Here's the error message: Error Type: TypeError Error Value: unbound method connect() must be called with instance as first argument [...] File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSessionDA.py, line 213, in putFile (Object: RSession) File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSOAP/localRSOAPConnection.py, line 124, in uploadFile (Object: RSession) File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSOAP/localRSOAPConnection.py, line 49, in connect (Object: RSession) TypeError: (see above) and the 'offending' code: class RSession(localRSOAPConnection, SimpleItem): '''Connection object to the R Kernel''' # no connect method defined here ... # .... class localRSOAPConnection(RSOAPConnection): def connect(self): flag = RSOAPConnection.connect(self) if flag: self.__checklocal() return flag .... The localRSOAPConnection code works just fine in standalone Python. In Zope the localRSOAPConnection is extended by RSession with methods that are Zope-aware. My question is why is the call to 'connect' failing in Zope? I am passing a valid instance with the self argument... Ideas appreciated... -Greg LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
Hi Gregory, This is an issue with instances that descend from "ExtensionClass" (which your first class does). Read about the inheritedAttribute method in your Zope's lib/Components/ExtensionClass/doc/ExtensionClass.stx directory. - C Warnes, Gregory R wrote:
I've just modified a python product and I've started getting an error that doesn't make sense to me.
Here's the error message:
Error Type: TypeError Error Value: unbound method connect() must be called with instance as first argument [...] File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSessionDA.py, line 213, in putFile (Object: RSession) File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSOAP/localRSOAPConnection.py, line 124, in uploadFile (Object: RSession) File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSOAP/localRSOAPConnection.py, line 49, in connect (Object: RSession) TypeError: (see above)
and the 'offending' code:
class RSession(localRSOAPConnection, SimpleItem): '''Connection object to the R Kernel'''
# no connect method defined here ... # ....
class localRSOAPConnection(RSOAPConnection):
def connect(self): flag = RSOAPConnection.connect(self)
if flag: self.__checklocal()
return flag
....
The localRSOAPConnection code works just fine in standalone Python. In Zope the localRSOAPConnection is extended by RSession with methods that are Zope-aware.
My question is why is the call to 'connect' failing in Zope? I am passing a valid instance with the self argument...
Ideas appreciated...
-Greg
LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Zope Corporation http://www.zope.org http://www.zope.com "Killing hundreds of birds with thousands of stones"
this is a common problem, see http://debian.acm.ndsu.nodak.edu/doc/python-extclass/ExtensionClass.html for a description (search for 'inheritedAttribute') hth, peter. Warnes, Gregory R wrote:
I've just modified a python product and I've started getting an error that doesn't make sense to me.
Here's the error message:
Error Type: TypeError Error Value: unbound method connect() must be called with instance as first argument [...] File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSessionDA.py, line 213, in putFile (Object: RSession) File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSOAP/localRSOAPConnection.py, line 124, in uploadFile (Object: RSession) File /Volumes/app/appman/lib/zope/Zope-2.5.1-solaris-2.6-sparc/Products/RSessionD A/RSOAP/localRSOAPConnection.py, line 49, in connect (Object: RSession) TypeError: (see above)
and the 'offending' code:
class RSession(localRSOAPConnection, SimpleItem): '''Connection object to the R Kernel'''
# no connect method defined here ... # ....
class localRSOAPConnection(RSOAPConnection):
def connect(self): flag = RSOAPConnection.connect(self)
if flag: self.__checklocal()
return flag
....
The localRSOAPConnection code works just fine in standalone Python. In Zope the localRSOAPConnection is extended by RSession with methods that are Zope-aware.
My question is why is the call to 'connect' failing in Zope? I am passing a valid instance with the self argument...
Ideas appreciated...
-Greg
LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Chris McDonough -
peter sabaini -
Warnes, Gregory R