Marcin wrote: > Hello everyone, > > I have stumbled upon what's probably an idiotic newbie problem: if I add > any method to a class, I get System.MissingMemberException. E.g. > > import clr > clr.AddReference('System.Windows.Forms') > > from System.Windows.Forms import * > > > class MyForm(Form): > def __init__(self): > button = Button() > button.Text = 'Click Me' > self.button = button > self.Controls.Add(button) > x = 'abc' > b = self.func(range(5)) > > def func(self, x): > return x > > > form = MyForm() > Application.Run(form) > > > If I comment out func and reference to func in __init__, it works. > However, with func I get lots of exceptions: > > 'ipyw.exe' (Managed (v4.0.30319)): Loaded > 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e > 089\mscorlib.dll', > Skipped loading symbols. Module is optimized and the debugger option > 'Just My Code' is enabled. > 'ipyw.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and > Settings\Administrator\Local Settings\Application > Data\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools > for Visual Studio\0.3\ipyw.exe' > 'ipyw.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and > Settings\Administrator\Local Settings\Application > Data\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools > for Visual Studio\0.3\Microsoft.Dynamic.dll' > 'ipyw.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and > Settings\Administrator\Local Settings\Application > Data\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools > for Visual Studio\0.3\Microsoft.Scripting.dll' > 'ipyw.exe' (Managed (v4.0.30319)): Loaded > 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0_ > _b03f5f7f11d50a3a\System.Configuration.dll', > Skipped loading symbols. Module is optimized and the debugger option > 'Just My Code' is enabled. > 'ipyw.exe' (Managed (v4.0.30319)): Loaded > 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e > 089\System.dll', > Skipped loading symbols. Module is optimized and the debugger option > 'Just My Code' is enabled. > 'ipyw.exe' (Managed (v4.0.30319)): Loaded > 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561 > 934e089\System.Xml.dll', > Skipped loading symbols. Module is optimized and the debugger option > 'Just My Code' is enabled. > 'ipyw.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and > Settings\Administrator\Local Settings\Application > Data\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools > for Visual Studio\0.3\IronPython.dll' > 'ipyw.exe' (Managed (v4.0.30319)): Loaded > 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c56 > 1934e089\System.Core.dll', > Skipped loading symbols. Module is optimized and the debugger option > 'Just My Code' is enabled. > 'ipyw.exe' (Managed (v4.0.30319)): Loaded > 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a > 5c561934e089\System.Numerics.dll', > Skipped loading symbols. Module is optimized and the debugger option > 'Just My Code' is enabled. > 'ipyw.exe' (Managed (v4.0.30319)): Loaded 'C:\Documents and > Settings\Administrator\Local Settings\Application > Data\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython Tools > for Visual Studio\0.3\IronPython.Modules.dll' > 'ipyw.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting' > 'ipyw.exe' (Managed (v4.0.30319)): Loaded > 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11 > d50a3a\ISymWrapper.dll' > 'ipyw.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted > DynamicMethods Assembly' > A first chance exception of type > 'Microsoft.Scripting.ArgumentTypeException' occurred in > Snippets.debug.scripting > 'ipyw.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting' > A first chance exception of type 'System.MissingMemberException' > occurred in IronPython.dll > A first chance exception of type > 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll > A first chance exception of type > 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll > A first chance exception of type > 'IronPython.Runtime.UnboundNameException' occurred in Microsoft.Dynamic.dll > A first chance exception of type > 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll > A first chance exception of type 'System.MissingMemberException' > occurred in IronPython.dll > A first chance exception of type 'System.MissingMemberException' > occurred in IronPython.dll > A first chance exception of type 'System.MissingMemberException' > occurred in IronPython.dll > A first chance exception of type 'System.MissingMemberException' > occurred in IronPython.dll > A first chance exception of type 'System.MissingMemberException' > occurred in IronPython.dll > A first chance exception of type 'System.MissingMemberException' > occurred in IronPython.dll > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > A first chance exception of type 'System.ComponentModel.Win32Exception' > occurred in Microsoft.Dynamic.dll > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > A first chance exception of type > 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll > The program '[2408] ipyw.exe: Managed (v4.0.30319)' has exited with code > 1 (0x1). > > > Note: I'm using VS 2010 Pro with IronPython Tools CP3.
Most of these exceptions are coming from the standard library on startup. For the next release I think these should all be gone. I don't see any one of these which stands out as the exception which was breaking your code though. I would have expected it to be the last one but ImportException doesn't seem like it should be caused from the indentation. _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com