problem with External Methods
on 2.3.2 I just tried to add an External Method and got this error -- anyone have an idea? Seems like some stuff in ExternalMethod.py isn't getting initialized (for example, if I initialize func_defaults in the .py I'm trying to externalize, it gives another error, about func_code). Is there requirements of the .py, something that needs to be imported or whatever, for this product to work? Error listing: Zope Error Zope has encountered an error while publishing this resource. Error Type: AttributeError Error Value: func_defaults Troubleshooting Suggestions The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. Traceback (innermost last): File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/Zope-2.3.1/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_addExternalMethod) File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: manage_addExternalMethod) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMethod .py, line 131, in manage_addExternalMethod File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMethod .py, line 179, in __init__ (Object: mp3info) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMethod .py, line 202, in manage_edit (Object: mp3info) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMethod .py, line 217, in getFunction (Object: mp3info) AttributeError: (see above)
Hi marc, it would be more helpful if you provide your external methods code also :) Regards Tino --On Montag, 30. April 2001 16:39 -0400 marc lindahl <marc@bowery.com> wrote:
on 2.3.2 I just tried to add an External Method and got this error -- anyone have an idea? Seems like some stuff in ExternalMethod.py isn't getting initialized (for example, if I initialize func_defaults in the .py I'm trying to externalize, it gives another error, about func_code). Is there requirements of the .py, something that needs to be imported or whatever, for this product to work?
Error listing:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: AttributeError Error Value: func_defaults
Troubleshooting Suggestions
The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the HTML source for this page.
If the error persists please contact the site maintainer. Thank you for your patience.
Traceback (innermost last): File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/Zope-2.3.1/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_addExternalMethod) File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: manage_addExternalMethod) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet hod .py, line 131, in manage_addExternalMethod File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet hod .py, line 179, in __init__ (Object: mp3info) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet hod .py, line 202, in manage_edit (Object: mp3info) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet hod .py, line 217, in getFunction (Object: mp3info) AttributeError: (see above)
_______________________________________________ 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 )
OK, I put it here, for now (it's not done, yet): http://www.zope.org/Members/bowerymarc/junk/mp3info.py http://www.zope.org/Members/bowerymarc/junk/READMEmp3info.txt
From: Tino Wildenhain <tino@wildenhain.de> Date: Tue, 01 May 2001 02:25:45 +0200 To: marc lindahl <marc@bowery.com>, zope@zope.org Subject: Re: [Zope] problem with External Methods
Hi marc,
it would be more helpful if you provide your external methods code also :)
Regards Tino
--On Montag, 30. April 2001 16:39 -0400 marc lindahl <marc@bowery.com> wrote:
on 2.3.2 I just tried to add an External Method and got this error -- anyone have an idea? Seems like some stuff in ExternalMethod.py isn't getting initialized (for example, if I initialize func_defaults in the .py I'm trying to externalize, it gives another error, about func_code). Is there requirements of the .py, something that needs to be imported or whatever, for this product to work?
Error listing:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: AttributeError Error Value: func_defaults
Troubleshooting Suggestions
The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the HTML source for this page.
If the error persists please contact the site maintainer. Thank you for your patience.
Traceback (innermost last): File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/Zope-2.3.1/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_addExternalMethod) File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: manage_addExternalMethod) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet hod .py, line 131, in manage_addExternalMethod File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet hod .py, line 179, in __init__ (Object: mp3info) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet hod .py, line 202, in manage_edit (Object: mp3info) File /usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet hod .py, line 217, in getFunction (Object: mp3info) AttributeError: (see above)
_______________________________________________ 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 )
You can't use a class object as a function... in this case, you're defining the function name in the external method as "mp3info", which is a class, which is why you're getting this error. I don't see any functions at all in the file you posted. An external method wraps a Python function. Passing instances of classes defined in an external method is tricky as well, even if you are using a function. It seems like you really want to be building a Product. See the Zope Developer's Guide at http://www.zope.org/Documentation/ZDG for information on how to do this. - C ----- Original Message ----- From: "marc lindahl" <marc@bowery.com> To: "Tino Wildenhain" <tino@wildenhain.de>; <zope@zope.org> Sent: Monday, April 30, 2001 9:24 PM Subject: Re: [Zope] problem with External Methods
OK, I put it here, for now (it's not done, yet):
http://www.zope.org/Members/bowerymarc/junk/mp3info.py http://www.zope.org/Members/bowerymarc/junk/READMEmp3info.txt
From: Tino Wildenhain <tino@wildenhain.de> Date: Tue, 01 May 2001 02:25:45 +0200 To: marc lindahl <marc@bowery.com>, zope@zope.org Subject: Re: [Zope] problem with External Methods
Hi marc,
it would be more helpful if you provide your external methods code also :)
Regards Tino
--On Montag, 30. April 2001 16:39 -0400 marc lindahl <marc@bowery.com> wrote:
on 2.3.2 I just tried to add an External Method and got this error -- anyone have an idea? Seems like some stuff in ExternalMethod.py isn't getting initialized (for example, if I initialize func_defaults in the .py I'm trying to externalize, it gives another error, about func_code). Is there requirements of the .py, something that needs to be imported or whatever, for this product to work?
Error listing:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: AttributeError Error Value: func_defaults
Troubleshooting Suggestions
The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error.
For more detailed information about the error, please refer to the HTML source for this page.
If the error persists please contact the site maintainer. Thank you for your patience.
Traceback (innermost last): File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 223, in publish_module File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/Zope-2.3.1/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_addExternalMethod) File /usr/local/zope/Zope-2.3.1/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: manage_addExternalMethod) File
/usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet
hod .py, line 131, in manage_addExternalMethod File
/usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet
hod .py, line 179, in __init__ (Object: mp3info) File
/usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet
hod .py, line 202, in manage_edit (Object: mp3info) File
/usr/local/zope/Zope-2.3.1/lib/python/Products/ExternalMethod/ExternalMet
hod .py, line 217, in getFunction (Object: mp3info) AttributeError: (see above)
_______________________________________________ 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 )
_______________________________________________ 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 )
Hi Chris,
You can't use a class object as a function... in this case, you're defining the function name in the external method as "mp3info", which is a class, which is why you're getting this error.
I don't see any functions at all in the file you posted. An external method wraps a Python function. Passing instances of classes defined in an external method is tricky as well, even if you are using a function.
Yeah, the file is just a class. So if I put this line in the file: m = mp3info() Then I could import m?
It seems like you really want to be building a Product. See the Zope Developer's Guide at http://www.zope.org/Documentation/ZDG for information on how to do this.
Yeah, that's what I'm working on... I was trying to do it with ZClasses, to make dealing with the property sheets easier, but I kinda figured out how to do that in python, so I'm just doing the whole thing in python. I'm sure I'll have lots more questions before I'm done :)
Yeah, the file is just a class. So if I put this line in the file:
m = mp3info()
Then I could import m?
No (because class instances aren't functions, although they can masquerade as one.. in this case it's just not worth it). You really want to make a Product. External methods are most useful for short functions, and they get really awkward when you combine them with classes due to security assertions that need be made, pickleability of class instances, and other things that can bite you. In short, don't. ;-)
It seems like you really want to be building a Product. See the Zope Developer's Guide at http://www.zope.org/Documentation/ZDG for
information
on how to do this.
Yeah, that's what I'm working on... I was trying to do it with ZClasses, to make dealing with the property sheets easier, but I kinda figured out how to do that in python, so I'm just doing the whole thing in python.
I'm sure I'll have lots more questions before I'm done :)
No problem... - C
participants (3)
-
Chris McDonough -
marc lindahl -
Tino Wildenhain