[IronPython] Object is not callable on clr.accepts decorated function

Dino Viehland dinov at microsoft.com
Fri Aug 6 00:44:03 CEST 2010


Can you just remove the decorators?  It looks like this is a template from the
old IronPython Studio support for older versions of VS.  The only reason for
the decorators is so that the code can round trip through the designer - which
is a non issue for you in Eclipse.

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Doug Warren
> Sent: Thursday, August 05, 2010 3:06 PM
> To: users at lists.ironpython.com
> Subject: [IronPython] Object is not callable on clr.accepts decorated function
> 
> I'm having problems with a simple WinForm, I've searched high and low
> and don't see what the issue is...  My problem is that when I try to
> add an event handler to a window form that uses the accepts/returns
> decorator, I get the error 'Object is not callable'  I've made some
> test apps of my own as well as tried modifying the sources of examples
> I've found online and all seem to have the problem.  The smallest
> reproduction I've had is:
> 
> from clr import AddReference, accepts, returns, Self
> AddReference("System.Windows.Forms")
> AddReference("System.Drawing")
> 
> import System
> from System.Windows.Forms import *
> from System.ComponentModel import *
> from System.Drawing import *
> 
> class DCCForms:
>     class Form1(System.Windows.Forms.Form):
>         def __init__(self):
>             self.InitializeComponent()
> 
>         @returns(None)
>         def InitializeComponent(self):
>             self.Name = 'Form1'
>             self.Text = 'DCC'
>             self.Load += self._Form1_Load
>             self.ResumeLayout(False)
>             self.PerformLayout()
> 
>         @accepts(Self(), System.Object, System.EventArgs)
>         @returns(None)
>         def _Form1_Load(self, sender, e):
>             pass
> 
> class WindowsApplication10:
>     @staticmethod
>     def RealEntryPoint():
>         Application.EnableVisualStyles()
>         Application.Run(DCCForms.Form1())
> 
> WindowsApplication10.RealEntryPoint();
> 
> I'm running IronPython 2.6.1 from inside Eclipse with PyDev, and I get
> 'TypeError: Object is not callable.' on line 19.  Removing the
> decorators and the program executes though I'm not sure what side
> effects not having the decorators would lead to.
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




More information about the Ironpython-users mailing list