Hi, Could you include the following information please:
1. Is this with the modified registry or without? 2. Can you show the complete output with -X:ExceptionDetail? 3. If you do "dir(e)" before doing "e.Visible = True", does that change the behavior? 4. What happens if you do *not* use -X:PreferComDispatch? You will have to use the following script. c:\Test>ipy.exe -X:TabCompletion -X:ExceptionDetail IronPython console: 2.0 Copyright (c) Microsoft Corporation. All rights reserved. >>> import clr >>> clr.AddReference("Microsoft.Office.Interop.Excel") # expects the PIA to be >>> in the GAC on in the current folder >>> from Microsoft.Office.Interop.Excel import * >>> e = ApplicationClass() >>> ApplicationClass.Visible.SetValue(e, True) Thanks, Shri -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of nekomaho Sent: Saturday, December 22, 2007 12:18 AM To: Discussion of IronPython Subject: Re: [IronPython] AttributeError: '__ComObject' object has no attribute 'Visible' with -X:PreferComDispatch Hi, I get no AttributeError with IronPython 2.0 Alpha 7. thanks > Misha said - "I should add that having the registry keys alone would only > help if Excel PIAs are in the GAC as well (when installing Excel - you would > choose .NET Interoperability support)." You probably do not have the PIAs > installed. > > The problem is just a matter of initialiazation order. The IDispatch support > was not initialized by the time the "e.Visible = True" statement was > executed. I have a fix and have just checked it in. The next IronPython drop > should have the fix. If you want a fix now, you can add the following lines > at the very start of PythonBinder.GetExtensionTypes. > > // Ensure that the type is initialized. If > ReflectedTypeBuilder.RegisterAlternateBuilder was used, > // the alternate builder will get a chance to initialize the type. > DynamicHelpers.GetPythonTypeFromType(t); > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of nekomaho > Sent: Friday, November 16, 2007 2:47 AM > To: Discussion of IronPython > Subject: Re: [IronPython] AttributeError: '__ComObject' object has no > attribute 'Visible' with -X:PreferComDispatch > > Hi, > > I changed registry but I get same error. > > IronPython-2.0A6>reg query > HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32 > /s > > ! REG.EXE VERSION 3.0 > > HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32 > Class REG_SZ Microsoft.Office.Interop.Excel.ApplicationClass > RuntimeVersion REG_SZ v1.1.4322 > > HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\12.0.0.0 > Class REG_SZ Microsoft.Office.Interop.Excel.ApplicationClass > RuntimeVersion REG_SZ v1.1.4322 > > IronPython-2.0A6>ipy.exe -X:PreferComDispatch -X:TabCompletion > -X:ExceptionDetail > IronPython console: IronPython 2.0A6 (2.0.11102.00) on .NET 2.0.50727.832 > Copyright (c) Microsoft Corporation. All rights reserved. >>>> import clr >>>> from System import Type, Activator >>>> t = Type.GetTypeFromProgID('Excel.Application') >>>> e = Activator.CreateInstance(t) >>>> e.Visible = True > '__ComObject' object has no attribute 'Visible' > 場所 Microsoft.Scripting.Ast.ThrowStatement.DoExecute(CodeContext context) > 場所 Microsoft.Scripting.Ast.Statement.Execute(CodeContext context) > 場所 > Microsoft.Scripting.Actions.ActionBinder.UpdateSiteAndExecute[T](CodeContext > callerContext, DynamicAction action, Object[] args, Object site, T& target, > RuleSet`1& rules) > 場所 > Microsoft.Scripting.Actions.DynamicSite`3.UpdateBindingAndInvoke(CodeContext > context, T0 arg0, T1 arg1) > 場所 > Microsoft.Scripting.Actions.DynamicSiteHelpers.UninitializedTargetHelper`7.Invoke2(DynamicSite`3 > site, CodeContext context, T0 arg0, T1 arg1) > 場所 Microsoft.Scripting.Actions.DynamicSite`3.Invoke(CodeContext context, > T0 arg0, T1 arg1) > 場所 ##29(Object[] , CodeContext ) > 場所 Microsoft.Scripting.ScriptCode.Run(CodeContext codeContext, Boolean > tryEvaluate) > 場所 Microsoft.Scripting.ScriptCode.Run(ScriptModule module) > 場所 Microsoft.Scripting.Hosting.CompiledCode.Evaluate(IScriptModule module) > 場所 Microsoft.Scripting.Hosting.ScriptEngine.ExecuteCommand(String code, > IScriptModule module) > 場所 Microsoft.Scripting.Shell.CommandLine.RunOneInteraction() > 場所 Microsoft.Scripting.Shell.CommandLine.TryInteractiveAction() > 場所 IronPython.Hosting.PythonCommandLine.TryInteractiveAction() > 場所 Microsoft.Scripting.Shell.CommandLine.RunInteractiveLoop() > AttributeError: '__ComObject' object has no attribute 'Visible' > > Thanks > >> The behavior currently depends on whether or not the RCW gets strongly-typed >> when it enters the managed world. As a workaround, the following registry >> script Misha provided could "fix" your machine by registering the PIA: >> >> Windows Registry Editor Version 5.00 >> >> [HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32] >> "Assembly"="Microsoft.Office.Interop.Excel, Version=12.0.0.0, >> Culture=neutral, PublicKeyToken=71E9BCE111E9429C" >> "Class"="Microsoft.Office.Interop.Excel.ApplicationClass" >> "RuntimeVersion"="v1.1.4322" >> >> [HKEY_CLASSES_ROOT\CLSID\{00024500-0000-0000-C000-000000000046}\InprocServer32\12.0.0.0] >> "Assembly"="Microsoft.Office.Interop.Excel, Version=12.0.0.0, >> Culture=neutral, PublicKeyToken=71E9BCE111E9429C" >> "Class"="Microsoft.Office.Interop.Excel.ApplicationClass" >> "RuntimeVersion"="v1.1.4322" >> >> Your script should work independent of whether the PIA is registered or not. >> We will look into it and see what is going. >> >> The implementation of -X:PreferComDispatch is still not complete. We are >> working on improving it and will enable it by default once all issues are >> flushed out. You are on the cutting edge and providing us with advance >> feedback :) >> >> -----Original Message----- >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of nekomaho >> Sent: Thursday, November 15, 2007 4:45 AM >> To: Discussion of IronPython >> Subject: Re: [IronPython] AttributeError: '__ComObject' object has no >> attribute 'Visible' >> >> Hi, >> >> I use Windows XP Pro SP2 ja & Office 2007 Pro ja. >> >> IronPython-2.0A6>ipy.exe -X:PreferComDispatch -X:TabCompletion >> -X:ExceptionDetail >> IronPython console: IronPython 2.0A6 (2.0.11102.00) on .NET 2.0.50727.832 >> Copyright (c) Microsoft Corporation. All rights reserved. >>>>> import clr >>>>> from System import Type, Activator >>>>> t = Type.GetTypeFromProgID('Excel.Application') >>>>> e = Activator.CreateInstance(t) >>>>> e.Visible = True >> '__ComObject' object has no attribute 'Visible' >> 場所 Microsoft.Scripting.Ast.ThrowStatement.DoExecute(CodeContext context) >> 場所 Microsoft.Scripting.Ast.Statement.Execute(CodeContext context) >> 場所 >> Microsoft.Scripting.Actions.ActionBinder.UpdateSiteAndExecute[T](CodeContext >> callerContext, DynamicAction action, Object[] args, Object site, T& target, >> RuleSet`1& rules) >> 場所 >> Microsoft.Scripting.Actions.DynamicSite`3.UpdateBindingAndInvoke(CodeContext >> context, T0 arg0, T1 arg1) >> 場所 >> Microsoft.Scripting.Actions.DynamicSiteHelpers.UninitializedTargetHelper`7.Invoke2(DynamicSite`3 >> site, CodeContext context, T0 arg0, T1 arg1) >> 場所 Microsoft.Scripting.Actions.DynamicSite`3.Invoke(CodeContext context, >> T0 arg0, T1 arg1) >> 場所 ##29(Object[] , CodeContext ) >> 場所 Microsoft.Scripting.ScriptCode.Run(CodeContext codeContext, Boolean >> tryEvaluate) >> 場所 Microsoft.Scripting.ScriptCode.Run(ScriptModule module) >> 場所 Microsoft.Scripting.Hosting.CompiledCode.Evaluate(IScriptModule module) >> 場所 Microsoft.Scripting.Hosting.ScriptEngine.ExecuteCommand(String code, >> IScriptModule module) >> 場所 Microsoft.Scripting.Shell.CommandLine.RunOneInteraction() >> 場所 Microsoft.Scripting.Shell.CommandLine.TryInteractiveAction() >> 場所 IronPython.Hosting.PythonCommandLine.TryInteractiveAction() >> 場所 Microsoft.Scripting.Shell.CommandLine.RunInteractiveLoop() >> AttributeError: '__ComObject' object has no attribute 'Visible' >> >> Thanks >> >>> This works for me as well. Could you please re-run your code snippet under >>> the -X:ExceptionDetail mode and send us the output? Also, what versions of >>> Windows and Office are being used? >>> >>> Thanks >>> >>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mohammad >>> Tayseer >>> Sent: Wednesday, November 14, 2007 8:02 AM >>> To: Discussion of IronPython >>> Subject: Re: [IronPython] AttributeError: '__ComObject' object has no >>> attribute 'Visible' >>> >>> It works for me. What version of Excel do you use?? >>> >>> Mohammad Tayseer >>> http://spellcoder.com/blogs/tayseer >>> >>> ----- Original Message ---- >>> From: nekomaho <[EMAIL PROTECTED]> >>> >>> >>> Hi, >>> >>> I get AttributeError in IronPython 2.0A6 & A5, but 2.0A4 is ok. why? >>> >>> >>> ________________________________ >>> Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See >>> how.<http://us.rd.yahoo.com/evt=51732/*http:/overview.mail.yahoo.com/> >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Users mailing list >>> Users@lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users@lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users@lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com