[IronPython] COM Object Issue
I just discovered strange thing with COM (IP 2.0): D:\Downloads\IronPython-2.0-Bin\IronPython-2.0ipy.exe -X:ExceptionDetail -X:ShowClrExceptions IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.1433 Type help, copyright, credits or license for more information. import System wt=System.Type.GetTypeFromProgID(Word.Application) wa=System.Activator.CreateInstance(wt) wa.Documents.Add() Microsoft.Office.Interop.Word.DocumentClass (_Document) object at 0x002B wa.Documents[1] Error while invoking Item. в Microsoft.Scripting.Com.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo excepInfo, UInt32 argErr, String message) в _stub_$26##25(Closure , CallSite , DispCallable ) в Microsoft.Scripting.Actions.MatchCaller.Call1[T0,TRet](Func`3 target, CallSite site, Object[] args) в Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) в Microsoft.Scripting.Actions.UpdateDelegates.Update1[T,T0,TRet](CallSite site, T0 arg0) в _stub_$25##24(Closure , CallSite , ComObject , Int32 ) в Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, CallSite site, Object[] args) в Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) в Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) в _stub_$24##23(Closure , CallSite , Object , Int32 ) в Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, CallSite site, Object[] args) в Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args) в Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) в module$23##22(Closure , Scope , LanguageContext ) в Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope) в Microsoft.Scripting.ScriptCode.Run(Scope scope) в IronPython.Hosting.PythonCommandLine.c__DisplayClass1.RunOneInteractionb__0() StandardError: Error while invoking Item. CLR Exception: TargetParameterCountException : Error while invoking Item. wa.Documents[None,1] Microsoft.Office.Interop.Word.DocumentClass (_Document) object at 0x002B wa.Documents[1,1] Microsoft.Office.Interop.Word.DocumentClass (_Document) object at 0x002B It looks like IP's wa.Documents indexer make wrong call of .Item. -- Zaur ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Newbie Questions
Hi Dino, first of all, thanks for your reply 2008/12/5 Dino Viehland [EMAIL PROTECTED]: You can add a reference to the assembly and then import both the class and the enum. For example: import clr clr.AddReference('MyLibrary') from MyLibrary import MyClass, MyEnum MyClass().SomeMethod(MyEnum.SomeValue) Ok, I've just tested it and everything seems to work fine. The 2nd question... is this an app.exe.config file that you're reading? If so this might be helpful: http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic64732.aspx I couldn't realize actually the utility of the article. I'll try to explain my problem wit a litlle bit more of words. I've created a .NET library which reads some settings in the application configuration file. The library isn't actually used by any Console/WinForm/whatever application, but I just want to test it using the IronPython interactive console. So I created a MyLibrary.dll.config file, I run the IronPython console and I add the reference to my library. How can I force my library to read the proper .config file? Can I explicitly load a .config file? Thanks in advance, Giulio -- OnAir: http://www.giuliopetrucci.it http://www.fujikomonamour.com ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Newbie Questions
.NET config doesn't really have any concept of configuration for an individual DLL. Instead it only has a config for the exe which kicked things off (or actually for the current app domain). So the concept of a MyLibrary.dll.config file doesn't really exist AFAIK. So that basically leaves you with a few options. You could add your configuration to an ipy.exe.config file. Or you could try and force the .NET config APIs to explicitly load a config file (which is what I thought the blog post I linked to showed via ExeConfigurationFileMap/OpenMappedExeConfiguration). Or your DLL could provide its own configuration mechanism if you really feel like its settings should be independent from the app using it. But ultimately I think these are all the same problems you'll encounter when using your DLL from any other EXE. -Original Message- From: [EMAIL PROTECTED] [mailto:users- [EMAIL PROTECTED] On Behalf Of Giulio Petrucci Sent: Thursday, December 11, 2008 12:42 AM To: IronPython mailing list Subject: Re: [IronPython] Newbie Questions Hi Dino, first of all, thanks for your reply 2008/12/5 Dino Viehland [EMAIL PROTECTED]: You can add a reference to the assembly and then import both the class and the enum. For example: import clr clr.AddReference('MyLibrary') from MyLibrary import MyClass, MyEnum MyClass().SomeMethod(MyEnum.SomeValue) Ok, I've just tested it and everything seems to work fine. The 2nd question... is this an app.exe.config file that you're reading? If so this might be helpful: http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.wi ndowsforms/topic64732.aspx I couldn't realize actually the utility of the article. I'll try to explain my problem wit a litlle bit more of words. I've created a .NET library which reads some settings in the application configuration file. The library isn't actually used by any Console/WinForm/whatever application, but I just want to test it using the IronPython interactive console. So I created a MyLibrary.dll.config file, I run the IronPython console and I add the reference to my library. How can I force my library to read the proper .config file? Can I explicitly load a .config file? Thanks in advance, Giulio -- OnAir: http://www.giuliopetrucci.it http://www.fujikomonamour.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
Re: [IronPython] Newbie Questions
Hi Dino, 2008/12/11 Dino Viehland [EMAIL PROTECTED]: .NET config doesn't really have any concept of configuration for an individual DLL. Instead it only has a config for the exe which kicked things off (or actually for the current app domain). So the concept of a MyLibrary.dll.config file doesn't really exist AFAIK. Yes, I know. In fact the MyLibrary.dll.config is a conventional name - AFAIK - given by VisualStudio when creating a .config file for a .dll So that basically leaves you with a few options. You could add your configuration to an ipy.exe.config file. It's an interesting option... ;-) I'll play a bit around an let you know. But... Or you could try and force the .NET config APIs to explicitly load a config file (which is what I thought the blog post I linked to showed via ExeConfigurationFileMap/OpenMappedExeConfiguration). ...and this is the option I prefer. I tryed to follow the example you showd but it didn't work. Basically what I need is that each ConfigurationManager.AppSettings[*] reads the * setting from my config file. I'll investigate and, if I find anything interesting, I'll let you know. Thanks, Giulio -- OnAir: http://www.giuliopetrucci.it http://www.fujikomonamour.com ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Announcing IronPython 2.0
good news, thanks for yours' hard working... I noticed that the binary package haven't contain the help document, could you tell us what time the latest API document will be released? thanks -- Andy Tao[陶祖洪] 祖洪测试自动化 http://www.zuhong.cn 天是圆的,地是方的,凡事都要有个规矩! -- Original -- From: Dave Fugate[EMAIL PROTECTED]; Date: Thu, Dec 11, 2008 05:19 AM To: Discussion of IronPythonusers@lists.ironpython.com; Cc: [EMAIL PROTECTED][EMAIL PROTECTED]; Subject: [IronPython] Announcing IronPython 2.0 Hello Python Community, The IronPython and Dynamic Language Runtime teams are proud to announce the release of IronPython 2.0 final. IronPython 2.0 is the culmination of nearly two years worth of work resulting in a CPython 2.5 compatible release on .NET 2.0 SP1. By far, the biggest change to 2.0 is that our 1.1 codebase was refactored to run on top of the Dynamic Language Runtime. With this we automatically get improvements in many feature areas such as better ..NET interop support and hosting Python from managed code. There have been many other major improvements as well. The most notable are: ·An MSI installer for Windows platforms which includes parts of the CPython 2.5 standard library ·IronPython assemblies targeting Silverlight and tools such as Chiron to improve the Silverlight dynamic development experience ·The addition of more C-based standard modules such as cmath and _winreg ·Significant improvements in importing compatibility and features ·Distribution of IronPython under the Microsoft Public License which has been approved by OSI ·Performance improvements. On that note, a new Wiki page has been created for IronPython performance reports - see http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance ·Over 500 bugs have been closed in 2.0. 453 of these were reported on CodePlex ·Support for precompilation of Python source files into a single dll This seems like an opportune time to remind everyone that we fix bugs based on the number of votes they have on CodePlex. As we’re planning on releasing IronPython 2.0.1 fairly soon, please vote for your favorite bugs at http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx to help ensure they get fixed in time for the next release. We’d like to extend our gratitude to everyone in the IronPython community who reported bugs thereby making this a better release: milind, romank, chadaustin, sjmachin, davidfraser, TimothyFitz, drewid, sanxiyn, bashmohandes, pobrien, perhaps, haypo, Undebtedly, ayarrow, tscottw_cp, rope, arman0, eshaish, nivaldo, fuzzyman, CurtHagenlocher, Eloff, brucec, py_sunil, jacobg23, mziller, beaugunderson, gbraad, Oceanborn, tarlano, jbevain, glchapman, anthonybaxter, jdhardy, jjlee, haibo, doubleyewdee, jackeyoo, whit537, sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, grizlupo, rridge, lewisle, JoelBondurant, johnplatt, lthompson, debackerl, googen, tscottw, VoteFw, leppie, Qvin, heyssion2, CriGoT, baxeno, sbergman, Laurion, luntain, oldman, christmas, 05031972, kevgu, wilberforce, Korbinian, lclj, sorokerr, Eriol, tatwright, ais, TraumaPony, pelikhan, asafk, felixpollan, srid, atifaziz, vernondcole, fwereade, zpy, yanne, facorreia, Daneel, zvikag, psykotic, Cavingdeep, BEaton, sborde, orbital56, fbourgeois, antont, krosavcheg, ktc1, awilkins, ben2004uk, paulfelix, axl, JeffreySax, Lawouach, and KKI. You can download IronPython 2.0 at: http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 The IronPython Team BTW Updates to the IronPython 1.0 samples will be released shortly. Stay tuned to the IronPython mailing list for details.___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Announcing IronPython 2.0
Excuse me if this is known or not, but searching around has only turned up articles/mailing lists posts that are two years old, but does IronPython 2.0 support .NET attributes yet? I've seen some examples of doing it using stub classes in C# and then deriving from the in Python, but I'm not sure if this will work for me. I need to put an Attribute on a class, or method, in Python that takes a string argument. I can't think of a workaround to get this support. For example, in C# the class would be: class Foo { [MyNameAttribute(Test name)] public void Method() { Console.Write(test); } } And the string Test name could be different for each use of MyNameAttribute. I use it for internal registration purposes in my C# code. How would I write this class in IP? ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Announcing IronPython 2.0
We don't support this in IronPython 2.0, no. And oddly, no one seems to have added this as a desired feature in CodePlex, even though it's come up a few times before on this list. The most likely way that we'd initially provide support for this is to let you override the CLS backing class that's being used to represent your Python class -- this would mean that you'd need to do the code generation for the attribute yourself, though. On Thu, Dec 11, 2008 at 7:58 AM, Jeff Slutter [EMAIL PROTECTED]wrote: Excuse me if this is known or not, but searching around has only turned up articles/mailing lists posts that are two years old, but does IronPython 2.0 support .NET attributes yet? I've seen some examples of doing it using stub classes in C# and then deriving from the in Python, but I'm not sure if this will work for me. I need to put an Attribute on a class, or method, in Python that takes a string argument. I can't think of a workaround to get this support. For example, in C# the class would be: class Foo { [MyNameAttribute(Test name)] public void Method() { Console.Write(test); } } And the string Test name could be different for each use of MyNameAttribute. I use it for internal registration purposes in my C# code. How would I write this class in IP? ___ 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
Re: [IronPython] Announcing IronPython 2.0
Actually, IP has error messages about help that refer to things that don't exist -- such as the CHM help included in other distributions. At this point, I suspect IP is emulating CPython behavior too closely ;) So congrats on v2! I recall there was talk long ago about a PyPan-like service (including dependency tracking and such). I wonder if that's gone anywhere? From: users-boun...@lists.ironpython.com on behalf of Bill Chiles Sent: Thu 12/11/2008 12:03 PM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.0 You can always get the latest docs from http://www.codeplex.com/dlr/Wiki/View.aspx?title=Docs%20and%20specsreferringTitle=Home where I push specs and docs. IPy specific docs like the tutorial and whatnot are only in the IPy zips. bill From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Andy.Tao Sent: Thursday, December 11, 2008 3:34 AM To: Discussion of IronPython Subject: Re: [IronPython] Announcing IronPython 2.0 good news, thanks for yours' hard working... I noticed that the binary package haven't contain the help document, could you tell us what time the latest API document will be released? thanks -- Andy Tao[???] ??? http://www.zuhong.cn http://www.zuhong.cn/ ,,! -- Original -- From: Dave Fugatedfug...@microsoft.com; Date: Thu, Dec 11, 2008 05:19 AM To: Discussion of IronPythonusers@lists.ironpython.com; Cc: python-announce-l...@python.orgpython-announce-l...@python.org; Subject: [IronPython] Announcing IronPython 2.0 Hello Python Community, The IronPython and Dynamic Language Runtime teams are proud to announce the release of IronPython 2.0 final. IronPython 2.0 is the culmination of nearly two years worth of work resulting in a CPython 2.5 compatible release on .NET 2.0 SP1. By far, the biggest change to 2.0 is that our 1.1 codebase was refactored to run on top of the Dynamic Language Runtime http://www.codeplex.com/dlr . With this we automatically get improvements in many feature areas such as better ..NET interop support and hosting Python from managed code. There have been many other major improvements as well. The most notable are: ·An MSI installer for Windows platforms which includes parts of the CPython 2.5 standard library ·IronPython assemblies targeting Silverlight and tools such as Chiron to improve the Silverlight dynamic development experience ·The addition of more C-based standard modules such as cmath and _winreg ·Significant improvements in importing compatibility and features ·Distribution of IronPython under the Microsoft Public License which has been approved by OSI ·Performance improvements. On that note, a new Wiki page has been created for IronPython performance reports - see http://www.codeplex.com/IronPython/Wiki/View.aspx?title=IronPython%20Performance ·Over 500 bugs have been closed in 2.0. 453 of these were reported on CodePlex ·Support for precompilation of Python source files into a single dll This seems like an opportune time to remind everyone that we fix bugs based on the number of votes they have on CodePlex. As we're planning on releasing IronPython 2.0.1 fairly soon, please vote for your favorite bugs at http://www.codeplex.com/IronPython/WorkItem/AdvancedList.aspx to help ensure they get fixed in time for the next release. We'd like to extend our gratitude to everyone in the IronPython community who reported bugs thereby making this a better release: milind, romank, chadaustin, sjmachin, davidfraser, TimothyFitz, drewid, sanxiyn, bashmohandes, pobrien, perhaps, haypo, Undebtedly, ayarrow, tscottw_cp, rope, arman0, eshaish, nivaldo, fuzzyman, CurtHagenlocher, Eloff, brucec, py_sunil, jacobg23, mziller, beaugunderson, gbraad, Oceanborn, tarlano, jbevain, glchapman, anthonybaxter, jdhardy, jjlee, haibo, doubleyewdee, jackeyoo, whit537, sdahlbac, PeteHufnagel, jtenney, nriley, junfeng, grizlupo, rridge, lewisle, JoelBondurant, johnplatt, lthompson, debackerl, googen, tscottw, VoteFw, leppie, Qvin, heyssion2, CriGoT, baxeno, sbergman, Laurion, luntain, oldman, christmas, 05031972, kevgu, wilberforce, Korbinian, lclj, sorokerr, Eriol, tatwright, ais, TraumaPony, pelikhan, asafk, felixpollan, srid, atifaziz, vernondcole, fwereade, zpy, yanne, facorreia, Daneel, zvikag, psykotic, Cavingdeep, BEaton, sborde, orbital56, fbourgeois, antont, krosavcheg, ktc1, awilkins, ben2004uk, paulfelix, axl, JeffreySax, Lawouach, and KKI. You can download IronPython 2.0 at: http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=8365 The IronPython Team BTW Updates to the IronPython 1.0 samples will be released shortly. Stay tuned to the IronPython mailing list for details.