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

Doug Warren doug.warren at gmail.com
Fri Aug 6 00:06:10 CEST 2010

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

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):

        def InitializeComponent(self):
            self.Name = 'Form1'
            self.Text = 'DCC'
            self.Load += self._Form1_Load

        @accepts(Self(), System.Object, System.EventArgs)
        def _Form1_Load(self, sender, e):

class WindowsApplication10:
    def 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.

More information about the Ironpython-users mailing list