From Jimmy.Schementi at microsoft.com Tue Apr 1 00:30:27 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Mon, 31 Mar 2008 15:30:27 -0700 Subject: [IronPython] Mixing Languages with the DLR In-Reply-To: <47F1560F.2010801@voidspace.org.uk> References: <47F1560F.2010801@voidspace.org.uk> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A328457E90869E@NA-EXMSG-C116.redmond.corp.microsoft.com> I totally agree =) Unfortuantely, IronRuby on Rails is the high priority task for John Lam and his merry men for the next month or two, but language interop hopefully won't be too long after. > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, March 31, 2008 2:22 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Mixing Languages with the DLR > > Jimmy Schementi wrote: > > I know this works between Jscript and Python. Ruby doesn't yet play > by > > the rules for method lookup. Fire up dlrconsole and see for yourself: > > Ok - something for us to watch. Allowing users to script Resolver One > spreadsheets with Ruby could be fun. > > Michael > http://www.ironpythoninaction.com > > > > > http://dynamicsilverlight.net/see/dlrconsole > > > > js> function foo() { > > js| return 42 > > js| } > > py> a = foo() > > py> a > > 42.0 > > js> a > > 42.0 > > > > How it works? I believe it's something to do with sharing scopes, but > > you can take a look @ > > http://dynamicsilverlight.net/see/dlrconsole.zip. Everything is in > > /app/app.py > > > > John, any idea when Ruby will play nicely with other languages? > > > > ~Jimmy > > > > On 3/30/08 8:25 AM, "Michael Foord" > wrote: > > > > Hello all, > > > > A quick question on mixing languages with the DLR. If we have an > > execution scope that we have executed code in - can we execute > > code from > > another language in the same scope? > > > > If this is trivially easy (just use a different engine to execute > the > > code in the same scope) then we could make Resolver One > scriptable in > > the DLR language of your choosing... (Why anyone would want to > use > > anything other than Python I don't know). > > > > Michael > > http://www.ironpythoninaction.com > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > --------------------------------------------------------------------- > --- > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From Harry.Pierson at microsoft.com Tue Apr 1 01:36:21 2008 From: Harry.Pierson at microsoft.com (Harry Pierson) Date: Mon, 31 Mar 2008 16:36:21 -0700 Subject: [IronPython] FW: IronPython Studio 1.0 for Isolated and Integrated VS Shell Message-ID: Ken Levy from the Visual Studio extensibility team just blogged about the 1.0 new release of IronPython Studio (http://codeplex.com/IronPythonStudio). As is pointed out below, this new version supports the integrated VS08 Shell, which means that if you already have VS08 installed, IPy Studio will just snap right into it. If you don't have VS08, you can download the VS08 shell for free (directions on the site) Harry Pierson PM, IronPython harry.pierson at microsoft.com http://devhawk.net http://blogs.msdn.com/vsxteam/archive/2008/03/31/ironpython-studio-1-0-for-isolated-and-integrated-vs-shell.aspx IronPython is now available in for both integrated and isolated VS Shell, see blog post for details. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sholist at hotmail.com Tue Apr 1 21:43:20 2008 From: sholist at hotmail.com (Sho List) Date: Tue, 1 Apr 2008 19:43:20 +0000 Subject: [IronPython] Restricting IronPython/DLR in a Sandbox? Message-ID: Hello IronPythoners, I am using the IronPython 2 Beta 1 on .Net 2.0. My goal is to create a restricted sandbox for scripts to run in using the DLR. I have searched high and low and have not found a solution utilizing the latest python beta release and DLR. It would seem this is something that should be straightforward to accomplish as the DLR's ScriptRuntime.Create takes an AppDomain as an overload. And indeed, my Python engine and runtime are loaded in the remote AppDomain, however I can only get it to work when the AppDomain has FullTrust permissions. Anything lower (say Intranet Zone and the like) and it throws a Method Access Exceptions on the ScriptRuntime.Create method. I have tried creating the AppDomain like so: AppDomain.CreateDomain(name, defaultEvidence, appDomainSetup, defaultPermissions, TrustedAssemblies.ToArray) Where: name is the name defaultEvidence is the evidence for the restricted zone appDomainSetup sets the BaseDirectory defaultPermissions is the permission set of the restricted zone TrustedAssemblies is a list containing references to "Microsoft.Scripting", "IronPython", "IronPython.Modules" Using any zone other than MyComputer results in the exception. I am not stuck on getting a permission set from a predefined zone, I have tried creating permissions sets other ways with the same result. Using zones seems easier for illustration. I need IronPython scripts to be run in a fairly constrained environment. No file IO, no loading assemblies. Basically, just the ability for the user to interact with the Hosting apps object model with some basic .Net library functions like String etc. Thanks! _________________________________________________________________ Pack up or back up?use SkyDrive to transfer files or keep extra copies. Learn how. hthttp://www.windowslive.com/skydrive/overview.html?ocid=TXT_TAGLM_WL_Refresh_skydrive_packup_042008 -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Tue Apr 1 22:33:17 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 1 Apr 2008 13:33:17 -0700 Subject: [IronPython] Restricting IronPython/DLR in a Sandbox? In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011D816E69CF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Can you give us the full stack trace of the exception that gets thrown and also what version of the CLR are you running against? It may be the case that partial trust will require the latest and greatest patch of .NET as there have been some changes to enable reflection / reflection emit to work better in partial trust. But it could also be a DLR or IronPython bug when running in partial trust on the desktop CLR. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sho List Sent: Tuesday, April 01, 2008 12:43 PM To: users at lists.ironpython.com Subject: [IronPython] Restricting IronPython/DLR in a Sandbox? Hello IronPythoners, I am using the IronPython 2 Beta 1 on .Net 2.0. My goal is to create a restricted sandbox for scripts to run in using the DLR. I have searched high and low and have not found a solution utilizing the latest python beta release and DLR. It would seem this is something that should be straightforward to accomplish as the DLR's ScriptRuntime.Create takes an AppDomain as an overload. And indeed, my Python engine and runtime are loaded in the remote AppDomain, however I can only get it to work when the AppDomain has FullTrust permissions. Anything lower (say Intranet Zone and the like) and it throws a Method Access Exceptions on the ScriptRuntime.Create method. I have tried creating the AppDomain like so: AppDomain.CreateDomain(name, defaultEvidence, appDomainSetup, defaultPermissions, TrustedAssemblies.ToArray) Where: name is the name defaultEvidence is the evidence for the restricted zone appDomainSetup sets the BaseDirectory defaultPermissions is the permission set of the restricted zone TrustedAssemblies is a list containing references to "Microsoft.Scripting", "IronPython", "IronPython.Modules" Using any zone other than MyComputer results in the exception. I am not stuck on getting a permission set from a predefined zone, I have tried creating permissions sets other ways with the same result. Using zones seems easier for illustration. I need IronPython scripts to be run in a fairly constrained environment. No file IO, no loading assemblies. Basically, just the ability for the user to interact with the Hosting apps object model with some basic .Net library functions like String etc. Thanks! ________________________________ Pack up or back up-use SkyDrive to transfer files or keep extra copies. Learn how. -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Tue Apr 1 22:58:40 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 1 Apr 2008 13:58:40 -0700 Subject: [IronPython] Restricting IronPython/DLR in a Sandbox? In-Reply-To: <7AD436E4270DD54A94238001769C2227011D816E69CF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C2227011D816E69CF@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: (I think) I can repro this with the following code: static void Main() { AppDomainSetup info = new AppDomainSetup(); info.ApplicationBase = System.Environment.CurrentDirectory; info.ApplicationName = "Test"; Evidence evidence = new Evidence(); evidence.AddHost(new Zone(SecurityZone.Internet)); AppDomain newDomain = AppDomain.CreateDomain("test", evidence, info); ScriptRuntime runtime = ScriptRuntime.Create(newDomain); } System.MethodAccessException was unhandled Message="RemoteRuntimeFactory..ctor( Microsoft.Scripting.Hosting.ScriptRuntimeSetup)" Source="mscorlib" StackTrace: at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo) at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes) at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes) at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes) at Microsoft.Scripting.Hosting.ScriptRuntime.RemoteRuntimeFactory.CreateRuntime(AppDomain domain, ScriptRuntimeSetup setup) at Microsoft.Scripting.Hosting.ScriptRuntime.CreateInternal(AppDomain domain, ScriptRuntimeSetup setup) at Microsoft.Scripting.Hosting.ScriptRuntime.Create(AppDomain domain) at ConsoleApplication7.Program.Main() in C:\Users\CurtH\Documents\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication7\Program.cs:line 27 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: On Tue, Apr 1, 2008 at 1:33 PM, Dino Viehland wrote: > Can you give us the full stack trace of the exception that gets thrown > and also what version of the CLR are you running against? > > > > It may be the case that partial trust will require the latest and greatest > patch of .NET as there have been some changes to enable reflection / > reflection emit to work better in partial trust. But it could also be a DLR > or IronPython bug when running in partial trust on the desktop CLR. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Sho List > *Sent:* Tuesday, April 01, 2008 12:43 PM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] Restricting IronPython/DLR in a Sandbox? > > > > Hello IronPythoners, > > I am using the IronPython 2 Beta 1 on .Net 2.0. > > My goal is to create a restricted sandbox for scripts to run in using the > DLR. I have searched high and low and have not found a solution utilizing > the latest python beta release and DLR. It would seem this is something that > should be straightforward to accomplish as the DLR's ScriptRuntime.Createtakes an AppDomain as an overload. And indeed, my Python engine and runtime > are loaded in the remote AppDomain, however I can only get it to work when > the AppDomain has FullTrust permissions. Anything lower (say Intranet Zone > and the like) and it throws a Method Access Exceptions on the > ScriptRuntime.Create method. > > I have tried creating the AppDomain like so: > AppDomain.CreateDomain(name, defaultEvidence, appDomainSetup, > defaultPermissions, TrustedAssemblies.ToArray) > > Where: > name is the name > defaultEvidence is the evidence for the restricted zone > appDomainSetup sets the BaseDirectory > defaultPermissions is the permission set of the restricted zone > TrustedAssemblies is a list containing references to "Microsoft.Scripting", > "IronPython", "IronPython.Modules" > > Using any zone other than MyComputer results in the exception. I am not > stuck on getting a permission set from a predefined zone, I have tried > creating permissions sets other ways with the same result. Using zones seems > easier for illustration. > > I need IronPython scripts to be run in a fairly constrained environment. > No file IO, no loading assemblies. Basically, just the ability for the user > to interact with the Hosting apps object model with some basic .Net library > functions like String etc. > > Thanks! > ------------------------------ > > Pack up or back up?use SkyDrive to transfer files or keep extra copies. Learn > how. > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sholist at hotmail.com Wed Apr 2 00:52:28 2008 From: sholist at hotmail.com (Sho List) Date: Tue, 1 Apr 2008 22:52:28 +0000 Subject: [IronPython] Restricting IronPython/DLR in a Sandbox? In-Reply-To: References: Message-ID: Thanks Curt, that code does reproduce the exception I am getting. I am running on 2.0.50727.312 Thanks! _________________________________________________________________ More immediate than e-mail? Get instant access with Windows Live Messenger. http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_instantaccess_042008 -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Wed Apr 2 02:16:38 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 1 Apr 2008 17:16:38 -0700 Subject: [IronPython] Restricting IronPython/DLR in a Sandbox? In-Reply-To: References: Message-ID: For what it's worth, I got that result on 2.0.50727.1434. On Tue, Apr 1, 2008 at 3:52 PM, Sho List wrote: > > Thanks Curt, that code does reproduce the exception I am getting. I am > running on 2.0.50727.312 > > Thanks! > > ------------------------------ > More immediate than e-mail? Get instant access with Windows Live > Messenger. > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Thu Apr 3 07:03:05 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 2 Apr 2008 22:03:05 -0700 Subject: [IronPython] Restricting IronPython/DLR in a Sandbox? In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011D816E6E1A@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Thanks Curt for the repro and stack trace and thanks Sho for the original report. This is definitely a bug - we're using reflection to load an internal type in the remote domain and instead we could do it non-reflectively and avoid the security check. I've opened a bug (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15928) for this - it shouldn't be too hard to fix but there's a few things in the queue first. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Tuesday, April 01, 2008 5:17 PM To: Discussion of IronPython Subject: Re: [IronPython] Restricting IronPython/DLR in a Sandbox? For what it's worth, I got that result on 2.0.50727.1434. On Tue, Apr 1, 2008 at 3:52 PM, Sho List > wrote: Thanks Curt, that code does reproduce the exception I am getting. I am running on 2.0.50727.312 Thanks! ________________________________ More immediate than e-mail? Get instant access with Windows Live Messenger. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sls at iinet.net.au Fri Apr 4 04:35:54 2008 From: sls at iinet.net.au (Paul Turbett) Date: Fri, 04 Apr 2008 10:35:54 +0800 Subject: [IronPython] InvalidProgramException testing hosting under NUnit In-Reply-To: <8140eff40803120957x6d7420dboa157384c9bb73821@mail.gmail.com> References: <8140eff40803120753s3d74b8afw4a8a15f55095d664@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382523@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <8140eff40803120957x6d7420dboa157384c9bb73821@mail.gmail.com> Message-ID: <47F5940A.8090402@iinet.net.au> Hi Was there ever a solution to this problem? I'm getting the same thing, though not with NUnit. To port my IP interface from 1.1 to 2.0 (beta 1), I created a separate test application, which worked fine. However I'm merging the code into my "real" application, but I'm not able to create a ScriptEngine. _runtime = ScriptRuntime.Create(); string[] languages = _runtime.GetRegisteredLanguageIdentifiers(); // finds 18 languages, including "py" _engine = _runtime.GetEngine("py"); // <--- throws an exception Microsoft.Scripting.Runtime.InvalidImplementationException was unhandled Message="Type 'IronPython.Runtime.PythonContext' doesn't provide a suitable public constructor or its implementation is faulty." Source="Microsoft.Scripting" StackTrace: at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type actualType, Object[] args) at Microsoft.Scripting.Runtime.ScriptDomainManager.LanguageRegistration.LoadLanguageContext(ScriptDomainManager manager) at Microsoft.Scripting.Runtime.ScriptDomainManager.TryGetLanguageContext(String languageId, LanguageContext& languageContext) at Microsoft.Scripting.Hosting.ScriptRuntime.TryGetEngine(String languageId, ScriptEngine& engine) at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngine(String languageId) at Utilities.OSEPython..ctor(FileStream log) in C:\Projects\Utils\PythonEngine.cs:line 121 at Utilities.PythonFactory.Create(Boolean log) in C:\Projects\Utils\PythonEngine.cs:line 70 ... Not sure if it's important, but the application uses a few assemblies, and the IP wrapper classes are in a separate assembly to where they are used. Thanks, Paul Fernando Correia wrote: > 2008/3/12, Dino Viehland : > >> There's an inner exception here (probably from Importer.cs in MakeImportSite) but there isn't much info on it. Could you run it under a debugger and get that original stack trace? It's not clear to me why we would blow up there. >> > > > Thanks for your help. > > Sorry for some text in Portuguese below. I hope it doesn't get in the way. > > The exception occurs within class ReflectionUtils, method CreateInstance. > > Line 127 is: > return (T)Activator.CreateInstance(actualType, args); > > This in turns ends up calling the constructor public > PythonContext(ScriptDomainManager/*!*/ manager) in class > PythonContext. > > Line 120 is: > _importer = new Importer(this); > > A step into this line will cause the exception. > > The stack trace of the innermost exception > ([System.InvalidProgramException] = {"Common Language Runtime detectou > um programa inv?lido."}) is: > > em Microsoft.Scripting.RuntimeHelpers.CreateSimpleCallSite[T0,T1,T2,T3,T4,R]() > em IronPython.Runtime.Importer.MakeImportSite() na > C:\Temp\IronPython v2.0 Alpha > 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha > 74 > em IronPython.Runtime.Importer..cctor() na C:\Temp\IronPython v2.0 > Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha > 49 > > The stack trace of the outermost exception (base > {System.ApplicationException} = {"Uma exce??o foi acionada pelo > destino de uma chamada."}) is: > > em System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > SignatureStruct& signature, IntPtr declaringType) > em System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > SignatureStruct signature, RuntimeTypeHandle declaringType) > em System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > em System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > Binder binder, Object[] args, CultureInfo culture, Object[] > activationAttributes) > em System.Activator.CreateInstance(Type type, BindingFlags > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > Object[] activationAttributes) > em System.Activator.CreateInstance(Type type, Object[] args) > em Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > actualType, Object[] args) na C:\Temp\IronPython v2.0 Alpha > 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Utils\ReflectionUtils.cs:linha > 127 > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Fri Apr 4 04:49:17 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 3 Apr 2008 19:49:17 -0700 Subject: [IronPython] InvalidProgramException testing hosting under NUnit In-Reply-To: <47F5940A.8090402@iinet.net.au> References: <8140eff40803120753s3d74b8afw4a8a15f55095d664@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382523@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <8140eff40803120957x6d7420dboa157384c9bb73821@mail.gmail.com> <47F5940A.8090402@iinet.net.au> Message-ID: This indicates that your executable directory does not contain IronPython.Modules.dll. On Thu, Apr 3, 2008 at 7:35 PM, Paul Turbett wrote: > Hi > > Was there ever a solution to this problem? I'm getting the same thing, > though not with NUnit. To port my IP interface from 1.1 to 2.0 (beta 1), I > created a separate test application, which worked fine. However I'm merging > the code into my "real" application, but I'm not able to create a > ScriptEngine. > > _runtime = ScriptRuntime.Create(); > string[] languages = _runtime.GetRegisteredLanguageIdentifiers(); // > finds 18 languages, including "py" > _engine = _runtime.GetEngine("py"); // <--- throws an exception > > Microsoft.Scripting.Runtime.InvalidImplementationException was unhandled > Message="Type 'IronPython.Runtime.PythonContext' doesn't provide a > suitable public constructor or its implementation is faulty." > Source="Microsoft.Scripting" > StackTrace: > at Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > actualType, Object[] args) > at > Microsoft.Scripting.Runtime.ScriptDomainManager.LanguageRegistration.LoadLanguageContext(ScriptDomainManager > manager) > at > Microsoft.Scripting.Runtime.ScriptDomainManager.TryGetLanguageContext(String > languageId, LanguageContext& languageContext) > at Microsoft.Scripting.Hosting.ScriptRuntime.TryGetEngine(String > languageId, ScriptEngine& engine) > at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngine(String > languageId) > at Utilities.OSEPython..ctor(FileStream log) in > C:\Projects\Utils\PythonEngine.cs:line 121 > at Utilities.PythonFactory.Create(Boolean log) in > C:\Projects\Utils\PythonEngine.cs:line 70 > ... > > Not sure if it's important, but the application uses a few assemblies, and > the IP wrapper classes are in a separate assembly to where they are used. > > Thanks, Paul > > > Fernando Correia wrote: > > 2008/3/12, Dino Viehland : > > > There's an inner exception here (probably from Importer.cs in MakeImportSite) but there isn't much info on it. Could you run it under a debugger and get that original stack trace? It's not clear to me why we would blow up there. > > > Thanks for your help. > > Sorry for some text in Portuguese below. I hope it doesn't get in the way. > > The exception occurs within class ReflectionUtils, method CreateInstance. > > Line 127 is: > return (T)Activator.CreateInstance(actualType, args); > > This in turns ends up calling the constructor public > PythonContext(ScriptDomainManager/*!*/ manager) in class > PythonContext. > > Line 120 is: > _importer = new Importer(this); > > A step into this line will cause the exception. > > The stack trace of the innermost exception > ([System.InvalidProgramException] = {"Common Language Runtime detectou > um programa inv?lido."}) is: > > em Microsoft.Scripting.RuntimeHelpers.CreateSimpleCallSite[T0,T1,T2,T3,T4,R]() > em IronPython.Runtime.Importer.MakeImportSite() na > C:\Temp\IronPython v2.0 Alpha > 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha > 74 > em IronPython.Runtime.Importer..cctor() na C:\Temp\IronPython v2.0 > Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha > 49 > > The stack trace of the outermost exception (base > {System.ApplicationException} = {"Uma exce??o foi acionada pelo > destino de uma chamada."}) is: > > em System.RuntimeMethodHandle._InvokeConstructor(Object[] args, > SignatureStruct& signature, IntPtr declaringType) > em System.RuntimeMethodHandle.InvokeConstructor(Object[] args, > SignatureStruct signature, RuntimeTypeHandle declaringType) > em System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags > invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) > em System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, > Binder binder, Object[] args, CultureInfo culture, Object[] > activationAttributes) > em System.Activator.CreateInstance(Type type, BindingFlags > bindingAttr, Binder binder, Object[] args, CultureInfo culture, > Object[] activationAttributes) > em System.Activator.CreateInstance(Type type, Object[] args) > em Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > actualType, Object[] args) na C:\Temp\IronPython v2.0 Alpha > 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Utils\ReflectionUtils.cs:linha > 127 > _______________________________________________ > Users mailing listUsers at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daftspaniel at gmail.com Fri Apr 4 23:40:37 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Fri, 4 Apr 2008 22:40:37 +0100 Subject: [IronPython] URLLIB Issue Message-ID: <20253b0c0804041440iad61528tbd8fa37409428de@mail.gmail.com> Hello List, Has this been covered before? Trailed Codeplex and mailing list :-) import encodings import twitter api = twitter.Api() statuses = api.GetPublicTimeline() print [s.user.name for s in statuses] Produces: Traceback (most recent call last): File it.py, line 4, in Initialize File C:\Code\OSProjects\twitter.py, line 923, in GetPublicTimeline File C:\Code\OSProjects\twitter.py, line 1435, in _FetchUrl File C:\python25\lib\urllib2.py, line 381, in open File C:\python25\lib\urllib2.py, line 398, in _open File Snippets.debug, line unknown, in _call_chain File C:\python25\lib\urllib2.py, line 360, in _call_chain File C:\python25\lib\urllib2.py, line 1107, in http_open File C:\python25\lib\urllib2.py, line 1096, in do_open TypeError: _fileobject() got an unexpected keyword argument 'close' CPython works as expected. Thanks, Davy -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Sat Apr 5 00:10:11 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 4 Apr 2008 15:10:11 -0700 Subject: [IronPython] URLLIB Issue In-Reply-To: <20253b0c0804041440iad61528tbd8fa37409428de@mail.gmail.com> References: <20253b0c0804041440iad61528tbd8fa37409428de@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227011D818B776B@DF-GRTDANE-MSG.exchange.corp.microsoft.com> I haven't seen this one before - the repro seems to be as simple as: import socket socket._fileobject(None, close='abc') but it's not clear to me what providing close does. Urllib2 seems to be passing True - does anyone know what it does? My guess is it causes the socket to be passed in but it's not documented. If that was what it does it'd be easy enough to fix. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell Sent: Friday, April 04, 2008 2:41 PM To: Discussion of IronPython Subject: [IronPython] URLLIB Issue Hello List, Has this been covered before? Trailed Codeplex and mailing list :-) import encodings import twitter api = twitter.Api() statuses = api.GetPublicTimeline() print [s.user.name for s in statuses] Produces: Traceback (most recent call last): File it.py, line 4, in Initialize File C:\Code\OSProjects\twitter.py, line 923, in GetPublicTimeline File C:\Code\OSProjects\twitter.py, line 1435, in _FetchUrl File C:\python25\lib\urllib2.py, line 381, in open File C:\python25\lib\urllib2.py, line 398, in _open File Snippets.debug, line unknown, in _call_chain File C:\python25\lib\urllib2.py, line 360, in _call_chain File C:\python25\lib\urllib2.py, line 1107, in http_open File C:\python25\lib\urllib2.py, line 1096, in do_open TypeError: _fileobject() got an unexpected keyword argument 'close' CPython works as expected. Thanks, Davy -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sat Apr 5 00:36:53 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 4 Apr 2008 15:36:53 -0700 Subject: [IronPython] URLLIB Issue In-Reply-To: <7AD436E4270DD54A94238001769C2227011D818B776B@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <20253b0c0804041440iad61528tbd8fa37409428de@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D818B776B@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: In CPython 2.5.2, the "prototype" of _fileobject.__init__ is this: def __init__(self, sock, mode='rb', bufsize=-1, close=False): The close flag controls whether or not the socket should be closed when the file is closed. As such, this may be directly related to CodePlex issue 10825 -- and indicates that the solution I suggested for that issue is again totally wrong. :) On Fri, Apr 4, 2008 at 3:10 PM, Dino Viehland wrote: > I haven't seen this one before ? the repro seems to be as simple as: > > > > import socket > > socket._fileobject(None, close='abc') > > > > but it's not clear to me what providing close does. Urllib2 seems to be > passing True ? does anyone know what it does? My guess is it causes the > socket to be passed in but it's not documented. If that was what it does > it'd be easy enough to fix. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Davy Mitchell > *Sent:* Friday, April 04, 2008 2:41 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] URLLIB Issue > > > > Hello List, > > Has this been covered before? Trailed Codeplex and mailing list :-) > > import encodings > import twitter > api = twitter.Api() > statuses = api.GetPublicTimeline() > print [s.user.name for s in statuses] > > Produces: > > Traceback (most recent call last): > File it.py, line 4, in Initialize > File C:\Code\OSProjects\twitter.py, line 923, in GetPublicTimeline > File C:\Code\OSProjects\twitter.py, line 1435, in _FetchUrl > File C:\python25\lib\urllib2.py, line 381, in open > File C:\python25\lib\urllib2.py, line 398, in _open > File Snippets.debug, line unknown, in _call_chain > File C:\python25\lib\urllib2.py, line 360, in _call_chain > File C:\python25\lib\urllib2.py, line 1107, in http_open > File C:\python25\lib\urllib2.py, line 1096, in do_open > TypeError: _fileobject() got an unexpected keyword argument 'close' > > CPython works as expected. > > Thanks, > Davy > > -- > Davy Mitchell > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > Twitter - http://twitter.com/daftspaniel > Skype - daftspaniel http://needgod.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sls at iinet.net.au Sat Apr 5 09:08:18 2008 From: sls at iinet.net.au (Paul Turbett) Date: Sat, 05 Apr 2008 15:08:18 +0800 Subject: [IronPython] InvalidProgramException testing hosting under NUnit In-Reply-To: References: <8140eff40803120753s3d74b8afw4a8a15f55095d664@mail.gmail.com> <7AD436E4270DD54A94238001769C2227011D80382523@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <8140eff40803120957x6d7420dboa157384c9bb73821@mail.gmail.com> <47F5940A.8090402@iinet.net.au> Message-ID: <47F72562.9010005@iinet.net.au> That was it. Curt to the rescue again. Thanks. A possible suggestion would be a more descriptive error message :) Curt Hagenlocher wrote: > This indicates that your executable directory does not contain > IronPython.Modules.dll. > > On Thu, Apr 3, 2008 at 7:35 PM, Paul Turbett > wrote: > > Hi > > Was there ever a solution to this problem? I'm getting the same > thing, though not with NUnit. To port my IP interface from 1.1 to > 2.0 (beta 1), I created a separate test application, which worked > fine. However I'm merging the code into my "real" application, but > I'm not able to create a ScriptEngine. > > _runtime = ScriptRuntime.Create(); > string[] languages = > _runtime.GetRegisteredLanguageIdentifiers(); // finds 18 > languages, including "py" > _engine = _runtime.GetEngine("py"); // <--- throws an exception > > Microsoft.Scripting.Runtime.InvalidImplementationException was > unhandled > Message="Type 'IronPython.Runtime.PythonContext' doesn't provide > a suitable public constructor or its implementation is faulty." > Source="Microsoft.Scripting" > StackTrace: > at > Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type > actualType, Object[] args) > at > Microsoft.Scripting.Runtime.ScriptDomainManager.LanguageRegistration.LoadLanguageContext(ScriptDomainManager > manager) > at > Microsoft.Scripting.Runtime.ScriptDomainManager.TryGetLanguageContext(String > languageId, LanguageContext& languageContext) > at > Microsoft.Scripting.Hosting.ScriptRuntime.TryGetEngine(String > languageId, ScriptEngine& engine) > at > Microsoft.Scripting.Hosting.ScriptRuntime.GetEngine(String languageId) > at Utilities.OSEPython..ctor(FileStream log) in > C:\Projects\Utils\PythonEngine.cs:line 121 > at Utilities.PythonFactory.Create(Boolean log) in > C:\Projects\Utils\PythonEngine.cs:line 70 > ... > > Not sure if it's important, but the application uses a few > assemblies, and the IP wrapper classes are in a separate assembly > to where they are used. > > Thanks, Paul > > > Fernando Correia wrote: >> 2008/3/12, Dino Viehland : >> >>> There's an inner exception here (probably from Importer.cs in MakeImportSite) but there isn't much info on it. Could you run it under a debugger and get that original stack trace? It's not clear to me why we would blow up there. >>> >> Thanks for your help. >> >> Sorry for some text in Portuguese below. I hope it doesn't get in the way. >> >> The exception occurs within class ReflectionUtils, method CreateInstance. >> >> Line 127 is: >> return (T)Activator.CreateInstance(actualType, args); >> >> This in turns ends up calling the constructor public >> PythonContext(ScriptDomainManager/*!*/ manager) in class >> PythonContext. >> >> Line 120 is: >> _importer = new Importer(this); >> >> A step into this line will cause the exception. >> >> The stack trace of the innermost exception >> ([System.InvalidProgramException] = {"Common Language Runtime detectou >> um programa inv?lido."}) is: >> >> em Microsoft.Scripting.RuntimeHelpers.CreateSimpleCallSite[T0,T1,T2,T3,T4,R]() >> em IronPython.Runtime.Importer.MakeImportSite() na >> C:\Temp\IronPython v2.0 Alpha >> 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha >> 74 >> em IronPython.Runtime.Importer..cctor() na C:\Temp\IronPython v2.0 >> Alpha 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha >> 49 >> >> The stack trace of the outermost exception (base >> {System.ApplicationException} = {"Uma exce??o foi acionada pelo >> destino de uma chamada."}) is: >> >> em System.RuntimeMethodHandle._InvokeConstructor(Object[] args, >> SignatureStruct& signature, IntPtr declaringType) >> em System.RuntimeMethodHandle.InvokeConstructor(Object[] args, >> SignatureStruct signature, RuntimeTypeHandle declaringType) >> em System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags >> invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) >> em System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, >> Binder binder, Object[] args, CultureInfo culture, Object[] >> activationAttributes) >> em System.Activator.CreateInstance(Type type, BindingFlags >> bindingAttr, Binder binder, Object[] args, CultureInfo culture, >> Object[] activationAttributes) >> em System.Activator.CreateInstance(Type type, Object[] args) >> em Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type >> actualType, Object[] args) na C:\Temp\IronPython v2.0 Alpha >> 8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Utils\ReflectionUtils.cs:linha >> 127 >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronnie.maor at gmail.com Sat Apr 5 11:35:12 2008 From: ronnie.maor at gmail.com (Ronnie Maor) Date: Sat, 5 Apr 2008 12:35:12 +0300 Subject: [IronPython] FW: IronPython Studio 1.0 for Isolated and Integrated VS Shell In-Reply-To: References: Message-ID: <2fd6b9d0804050235j6cdf0218y60cff76245818258@mail.gmail.com> this sounds great - integration with VS2008 will be much better than running with the experimental hive. however, after installing, my python projects failed to load, with the following error: "could not find any resources appropriate for the specified culture or neutral culture..." (see attached screenshot). also found this blog entry which sounds relevent: http://weblogs.asp.net/ngur/archive/2003/12/28/46219.aspx hoping this post will make it to someone who can fix the problem, or let me know how to work around it... thanks Ronnie On Tue, Apr 1, 2008 at 2:36 AM, Harry Pierson wrote: > Ken Levy from the Visual Studio extensibility team just blogged about the > 1.0 new release of IronPython Studio (http://codeplex.com/IronPythonStudio). > As is pointed out below, this new version supports the integrated VS08 > Shell, which means that if you already have VS08 installed, IPy Studio will > just snap right into it. If you don't have VS08, you can download the VS08 > shell for free (directions on the site) > > > > Harry Pierson > > PM, IronPython > > harry.pierson at microsoft.com > > http://devhawk.net > > > > > > > > > > > http://blogs.msdn.com/vsxteam/archive/2008/03/31/ironpython-studio-1-0-for-isolated-and-integrated-vs-shell.aspx > > > > IronPython is now available in for both integrated and isolated VS Shell, > see blog post for details. > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: resources.JPG Type: image/jpeg Size: 44809 bytes Desc: not available URL: From daftspaniel at gmail.com Sat Apr 5 15:06:38 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Sat, 5 Apr 2008 14:06:38 +0100 Subject: [IronPython] False? with Unit Test Message-ID: <20253b0c0804050606v323038c7l1f91f06764e68901@mail.gmail.com> Hello List, Found a little funny on the latest IPY. import unittest class ATest(unittest.TestCase): def setUp(self): self.pop = "" def test_blog(self): print "test" if __name__ == '__main__': unittest.main() Runs fine but under IPY there's a extra line with 'False' output: test . -------------------------------------------------------------- Ran one test in 0.096s OK False Anyone had more experience with this module? Davy -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sat Apr 5 19:16:10 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 5 Apr 2008 10:16:10 -0700 Subject: [IronPython] False? with Unit Test In-Reply-To: <20253b0c0804050606v323038c7l1f91f06764e68901@mail.gmail.com> References: <20253b0c0804050606v323038c7l1f91f06764e68901@mail.gmail.com> Message-ID: It's the call to sys.exit that does this. There's a subtle difference between IronPython 2.0B1 and CPython 2.5 when sys.exit is called with a boolean parameter. CPython doesn't print the value of the parameter if it's boolean, while IronPython does. Presumably, CPython does this for backwards compatibility with a time when it didn't have a boolean data type. I'd guess that sys.exit(False) gets the same behavior as sys.exit(0) while sys.exit(True) is the same as sys.exit(1). But I haven't checked the CPython source to confirm that guess. On Sat, Apr 5, 2008 at 6:06 AM, Davy Mitchell wrote: > Hello List, > > Found a little funny on the latest IPY. > > import unittest > > class ATest(unittest.TestCase): > def setUp(self): > self.pop = "" > def test_blog(self): > print "test" > > if __name__ == '__main__': > unittest.main() > > Runs fine but under IPY there's a extra line with 'False' output: > > test > . > -------------------------------------------------------------- > Ran one test in 0.096s > > OK > False > > Anyone had more experience with this module? > > Davy > > -- > Davy Mitchell > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > Twitter - http://twitter.com/daftspaniel > Skype - daftspaniel http://needgod.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sat Apr 5 19:21:33 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sat, 05 Apr 2008 18:21:33 +0100 Subject: [IronPython] False? with Unit Test In-Reply-To: References: <20253b0c0804050606v323038c7l1f91f06764e68901@mail.gmail.com> Message-ID: <47F7B51D.8060905@voidspace.org.uk> Curt Hagenlocher wrote: > It's the call to sys.exit that does this. > > There's a subtle difference between IronPython 2.0B1 and CPython 2.5 > when sys.exit is called with a boolean parameter. CPython doesn't > print the value of the parameter if it's boolean, while IronPython > does. Presumably, CPython does this for backwards compatibility with > a time when it didn't have a boolean data type. I'd guess that > sys.exit(False) gets the same behavior as sys.exit(0) while > sys.exit(True) is the same as sys.exit(1). But I haven't checked the > CPython source to confirm that guess. As bool inherits from int, calling 'sys.exit' with False ought to be exactly the equivalent of calling it with 0. (False == 0, True == 1). This obscure fact *is* because of backwards compatibility. Michael http://www.ironpythoninaction.com/ > > On Sat, Apr 5, 2008 at 6:06 AM, Davy Mitchell > wrote: > > Hello List, > > Found a little funny on the latest IPY. > > import unittest > > class ATest(unittest.TestCase): > def setUp(self): > self.pop = "" > def test_blog(self): > print "test" > > if __name__ == '__main__': > unittest.main() > > Runs fine but under IPY there's a extra line with 'False' output: > > test > . > -------------------------------------------------------------- > Ran one test in 0.096s > > OK > False > > Anyone had more experience with this module? > > Davy > > -- > Davy Mitchell > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > Twitter - http://twitter.com/daftspaniel > Skype - daftspaniel http://needgod.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From Harry.Pierson at microsoft.com Sat Apr 5 23:12:40 2008 From: Harry.Pierson at microsoft.com (Harry Pierson) Date: Sat, 5 Apr 2008 14:12:40 -0700 Subject: [IronPython] FW: IronPython Studio 1.0 for Isolated and Integrated VS Shell In-Reply-To: <2fd6b9d0804050235j6cdf0218y60cff76245818258@mail.gmail.com> References: <2fd6b9d0804050235j6cdf0218y60cff76245818258@mail.gmail.com> Message-ID: Two questions: 1. Did it work before with the previous IPy Studio? 2. Is it a web app? The URL you included related to web apps, and AFAIK IPy Studio doesn't include web app development support. Harry From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ronnie Maor Sent: Saturday, April 05, 2008 2:35 AM To: Discussion of IronPython Subject: Re: [IronPython] FW: IronPython Studio 1.0 for Isolated and Integrated VS Shell this sounds great - integration with VS2008 will be much better than running with the experimental hive. however, after installing, my python projects failed to load, with the following error: "could not find any resources appropriate for the specified culture or neutral culture..." (see attached screenshot). also found this blog entry which sounds relevent: http://weblogs.asp.net/ngur/archive/2003/12/28/46219.aspx hoping this post will make it to someone who can fix the problem, or let me know how to work around it... thanks Ronnie On Tue, Apr 1, 2008 at 2:36 AM, Harry Pierson > wrote: Ken Levy from the Visual Studio extensibility team just blogged about the 1.0 new release of IronPython Studio (http://codeplex.com/IronPythonStudio). As is pointed out below, this new version supports the integrated VS08 Shell, which means that if you already have VS08 installed, IPy Studio will just snap right into it. If you don't have VS08, you can download the VS08 shell for free (directions on the site) Harry Pierson PM, IronPython harry.pierson at microsoft.com http://devhawk.net http://blogs.msdn.com/vsxteam/archive/2008/03/31/ironpython-studio-1-0-for-isolated-and-integrated-vs-shell.aspx IronPython is now available in for both integrated and isolated VS Shell, see blog post for details. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Sun Apr 6 01:24:21 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 5 Apr 2008 16:24:21 -0700 Subject: [IronPython] False? with Unit Test In-Reply-To: <47F7B51D.8060905@voidspace.org.uk> References: <20253b0c0804050606v323038c7l1f91f06764e68901@mail.gmail.com> <47F7B51D.8060905@voidspace.org.uk> Message-ID: On Sat, Apr 5, 2008 at 10:21 AM, Michael Foord wrote: > > As bool inherits from int, calling 'sys.exit' with False ought to be > exactly the equivalent of calling it with 0. (False == 0, True == 1). SystemExitException.GetExitCode calls TypeCache.Int32.IsInstanceOfType with the argument to the exit function, and this function returns false when the type of the argument is System.Boolean. In other words, this discrepancy happens because TypeCache.Int32.IsInstanceOfType(false) == false TypeCache.Int32.IsInstanceOfType(4) == true Interestingly, a user-defined type that derives from "int" produces the correct response. -- Curt Hagenlocher curt at hagenlocher.org From janrou at gmail.com Sun Apr 6 02:09:29 2008 From: janrou at gmail.com (Pjerrot) Date: Sat, 5 Apr 2008 17:09:29 -0700 (PDT) Subject: [IronPython] Problem with 3 modules, classes and missing attributes Message-ID: <19659a43-4f01-44d8-8efb-ab69d94cb9e0@q10g2000prf.googlegroups.com> Hi, I have problem understanding IronPython. The problem is here: Traceback (most recent call last): File , line 0, in ##9 File , line 0, in __import__##4 File ..\NamespaceTest\program.py, line 28, in Initialize File ..\NamespaceTest\program.py, line 24, in start File ..\NamespaceTest\program.py, line 9, in testBar AttributeError: type object 'ns2' has no attribute 'Bar' I try to follow the namspace style created by Visual Studion IronPython. A namspace is cerated as a class, without a constructor. Inside the class is another class. The outer class works like a namespace. I create two files each holding a class, Bar and Foo. The files start with the same "class ns2:" for namspace "ns2". So Bar and Foo belong to the ns2 namespace. But when I try from another namspace "ns1" to uit test the classes. The ns2 namespace miss oe of the classes. Please give me an explanation. And, if you can, how can I structure the python code like C#. Hope somebody can help Pjerrot Attached are the three files: program.py, Bar.py and Foo.py. ---------------------------------- program.py: from Bar import * from Foo import * class ns1: #namespace def testBar(): bar = ns2.Bar(1) if bar.Y == 1: print "Bar.Y test OK" else: print "Bar.Y test failed" def testFooBar(): b = ns2.Bar.Bar(1) fb = ns2.FooBar(b) if fb.B == b.B: print "FooBar.B test OK" else: print "FooBar.B test failed" @staticmethod def start(): ns1.testBar() ns1.testFooBar() if __name__ == "program": ns1.start() ------------------------------------- Bar.py: class ns2: # namespace class Bar(object): def __init__(self, y=0): self._y = y # Y property def getY(self): return self._y def setY(self, value): self._y = value Y = property(getY,setY) ------------------------------------------ Foo.py class ns2: # namespace class FooBar(object): def __init__(self,b=None): self._b = b # B property def getB(self): return self._b def setB(self, value): self._b = value B = property(getB,setB) ------------------- From fuzzyman at voidspace.org.uk Sun Apr 6 02:13:50 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 06 Apr 2008 01:13:50 +0100 Subject: [IronPython] Problem with 3 modules, classes and missing attributes In-Reply-To: <19659a43-4f01-44d8-8efb-ab69d94cb9e0@q10g2000prf.googlegroups.com> References: <19659a43-4f01-44d8-8efb-ab69d94cb9e0@q10g2000prf.googlegroups.com> Message-ID: <47F815BE.9000607@voidspace.org.uk> Hello Pjerrot, Unfortunately the layout of code created by Visual Studio IronPython (do you mean IronPython Studio or Visual Studio Professional?) is a *terrible* way to write Python. It effectively matches the semantics of C#, but you should not replicate it yourself - do not contain your classes inside a namespace class. Additionally, do not use the 'from XXX import *' - but instead explicitly import the names you want to use. I don't say the last point out of dogma - I think if you make that change you will immediately see what is wrong with the code. All the best, Michael Foord http://www.ironpythoninaction.com/ Pjerrot wrote: > Hi, > > I have problem understanding IronPython. The problem is here: > > Traceback (most recent call last): > File , line 0, in ##9 > File , line 0, in __import__##4 > File ..\NamespaceTest\program.py, line 28, in Initialize > File ..\NamespaceTest\program.py, line 24, in start > File ..\NamespaceTest\program.py, line 9, in testBar > AttributeError: type object 'ns2' has no attribute 'Bar' > > I try to follow the namspace style created by Visual Studion > IronPython. A namspace is cerated as a class, without a constructor. > Inside the class is another class. The outer class works like a > namespace. > > I create two files each holding a class, Bar and Foo. The files start > with the same "class ns2:" for namspace "ns2". So Bar and Foo belong > to the ns2 namespace. But when I try from another namspace "ns1" to > uit test the classes. The ns2 namespace miss oe of the classes. > > Please give me an explanation. And, if you can, how can I structure > the python code like C#. > > Hope somebody can help > > Pjerrot > > > Attached are the three files: program.py, Bar.py and Foo.py. > ---------------------------------- > program.py: > from Bar import * > from Foo import * > > class ns1: #namespace > def testBar(): > bar = ns2.Bar(1) > if bar.Y == 1: > print "Bar.Y test OK" > else: > print "Bar.Y test failed" > def testFooBar(): > b = ns2.Bar.Bar(1) > fb = ns2.FooBar(b) > if fb.B == b.B: > print "FooBar.B test OK" > else: > print "FooBar.B test failed" > > @staticmethod > def start(): > ns1.testBar() > ns1.testFooBar() > > if __name__ == "program": > ns1.start() > ------------------------------------- > Bar.py: > class ns2: # namespace > > class Bar(object): > def __init__(self, y=0): > self._y = y > > # Y property > def getY(self): > return self._y > def setY(self, value): > self._y = value > Y = property(getY,setY) > ------------------------------------------ > Foo.py > class ns2: # namespace > > class FooBar(object): > def __init__(self,b=None): > self._b = b > > # B property > def getB(self): > return self._b > def setB(self, value): > self._b = value > B = property(getB,setB) > ------------------- > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From redmoon17 at gmail.com Sun Apr 6 02:57:16 2008 From: redmoon17 at gmail.com (Kevin Chu) Date: Sun, 6 Apr 2008 08:57:16 +0800 Subject: [IronPython] how to use IronPython 2.0 beta in IronPython Studio 1.0 Message-ID: <41d7f4a90804051757y5ba5860v4a782fa2ebba6622@mail.gmail.com> I found IronPython Studio 1.0 use IronPython 1.1, and how to use IronPython 2.0 beta in IronPython Studio 1.0? -- Once in a Redmoon -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronnie.maor at gmail.com Sun Apr 6 10:34:44 2008 From: ronnie.maor at gmail.com (Ronnie Maor) Date: Sun, 6 Apr 2008 11:34:44 +0300 Subject: [IronPython] FW: IronPython Studio 1.0 for Isolated and Integrated VS Shell In-Reply-To: References: <2fd6b9d0804050235j6cdf0218y60cff76245818258@mail.gmail.com> Message-ID: <2fd6b9d0804060134s1930a390n22fded21c2f48d5a@mail.gmail.com> two answers and some more info :-) 1) This is the first version IPy Studio version I've tried. I have VS2008 Pro, and have been working with the VS SDK sample in the experimental hive. The problem with the experimental hive is that we also have ReSharper and we couldn't get ReSharper to work in the hive or python support installed outside the hive, so we now have two IDEs. So when I saw your post on IPy Studio integrated mode, I decided to try it as a way to ditch the experimental hive. I installed using the binary integrated mode setup file (using all defaults), and then just tried to load my current solution and got the error message. I assumed that since IPy Studio was based on the sample it could just run my current solution with projects created with the sample in the experimental hive. Right now I'm guessing this is where I was wrong. 2) My python projects are class libraries, not web apps. The solution contains other projects which are C# libraries and a web app (ASP.NET in C#), but as far as I understand that shouldn't affect IPy Studio's ability to load my python project (?) I just tried creating a new solution with VS2008 + IPy Studio and creating python class libraries in it. This seems to work. Copying the files from my previous project and re-adding them to a new project also worked (although I didn't import all the files/directories yet) Copying the files + the project and trying to add the existing project failed again in the new solution with the same error. So now I have one configuration that seems to work and another that doesn't. I'll try building it the way that works and comparing the project files and hopefully will find what the difference is, and how to solve it, and post that here. However, if someone knows what the answer is already - please let me know :-) thanks Ronnie On Sun, Apr 6, 2008 at 12:12 AM, Harry Pierson wrote: > Two questions: > > > > 1. Did it work before with the previous IPy Studio? > > 2. Is it a web app? The URL you included related to web apps, and > AFAIK IPy Studio doesn't include web app development support. > > > > Harry > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Ronnie Maor > *Sent:* Saturday, April 05, 2008 2:35 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] FW: IronPython Studio 1.0 for Isolated and > Integrated VS Shell > > > > this sounds great - integration with VS2008 will be much better than > running with the experimental hive. > > however, after installing, my python projects failed to load, with the > following error: > "could not find any resources appropriate for the specified culture or > neutral culture..." (see attached screenshot). > > also found this blog entry which sounds relevent: > http://weblogs.asp.net/ngur/archive/2003/12/28/46219.aspx > > hoping this post will make it to someone who can fix the problem, or let > me know how to work around it... > > thanks > Ronnie > > On Tue, Apr 1, 2008 at 2:36 AM, Harry Pierson > wrote: > > Ken Levy from the Visual Studio extensibility team just blogged about the > 1.0 new release of IronPython Studio (http://codeplex.com/IronPythonStudio). > As is pointed out below, this new version supports the integrated VS08 > Shell, which means that if you already have VS08 installed, IPy Studio will > just snap right into it. If you don't have VS08, you can download the VS08 > shell for free (directions on the site) > > > > Harry Pierson > > PM, IronPython > > harry.pierson at microsoft.com > > http://devhawk.net > > > > > > > > > > > http://blogs.msdn.com/vsxteam/archive/2008/03/31/ironpython-studio-1-0-for-isolated-and-integrated-vs-shell.aspx > > > > IronPython is now available in for both integrated and isolated VS Shell, > see blog post for details. > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronnie.maor at gmail.com Sun Apr 6 10:37:43 2008 From: ronnie.maor at gmail.com (Ronnie Maor) Date: Sun, 6 Apr 2008 11:37:43 +0300 Subject: [IronPython] FW: IronPython Studio 1.0 for Isolated and Integrated VS Shell In-Reply-To: <2fd6b9d0804060134s1930a390n22fded21c2f48d5a@mail.gmail.com> References: <2fd6b9d0804050235j6cdf0218y60cff76245818258@mail.gmail.com> <2fd6b9d0804060134s1930a390n22fded21c2f48d5a@mail.gmail.com> Message-ID: <2fd6b9d0804060137teebea7ei9ec4446a5f3457bc@mail.gmail.com> forgot to mention that I'm using IPy 1.1.1 On Sun, Apr 6, 2008 at 11:34 AM, Ronnie Maor wrote: > two answers and some more info :-) > > 1) This is the first version IPy Studio version I've tried. I have VS2008 > Pro, and have been working with the VS SDK sample in the experimental hive. > The problem with the experimental hive is that we also have ReSharper and we > couldn't get ReSharper to work in the hive or python support installed > outside the hive, so we now have two IDEs. > So when I saw your post on IPy Studio integrated mode, I decided to try it > as a way to ditch the experimental hive. > I installed using the binary integrated mode setup file (using all > defaults), and then just tried to load my current solution and got the error > message. > > I assumed that since IPy Studio was based on the sample it could just run > my current solution with projects created with the sample in the > experimental hive. Right now I'm guessing this is where I was wrong. > > 2) My python projects are class libraries, not web apps. The solution > contains other projects which are C# libraries and a web app (ASP.NET in > C#), but as far as I understand that shouldn't affect IPy Studio's ability > to load my python project (?) > > I just tried creating a new solution with VS2008 + IPy Studio and creating > python class libraries in it. This seems to work. > Copying the files from my previous project and re-adding them to a new > project also worked (although I didn't import all the files/directories yet) > Copying the files + the project and trying to add the existing project > failed again in the new solution with the same error. > > So now I have one configuration that seems to work and another that > doesn't. I'll try building it the way that works and comparing the project > files and hopefully will find what the difference is, and how to solve it, > and post that here. > > However, if someone knows what the answer is already - please let me know > :-) > > thanks > Ronnie > > > On Sun, Apr 6, 2008 at 12:12 AM, Harry Pierson < > Harry.Pierson at microsoft.com> wrote: > > > Two questions: > > > > > > > > 1. Did it work before with the previous IPy Studio? > > > > 2. Is it a web app? The URL you included related to web apps, and > > AFAIK IPy Studio doesn't include web app development support. > > > > > > > > Harry > > > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > > users-bounces at lists.ironpython.com] *On Behalf Of *Ronnie Maor > > *Sent:* Saturday, April 05, 2008 2:35 AM > > *To:* Discussion of IronPython > > *Subject:* Re: [IronPython] FW: IronPython Studio 1.0 for Isolated and > > Integrated VS Shell > > > > > > > > this sounds great - integration with VS2008 will be much better than > > running with the experimental hive. > > > > however, after installing, my python projects failed to load, with the > > following error: > > "could not find any resources appropriate for the specified culture or > > neutral culture..." (see attached screenshot). > > > > also found this blog entry which sounds relevent: > > http://weblogs.asp.net/ngur/archive/2003/12/28/46219.aspx > > > > hoping this post will make it to someone who can fix the problem, or let > > me know how to work around it... > > > > thanks > > Ronnie > > > > On Tue, Apr 1, 2008 at 2:36 AM, Harry Pierson < > > Harry.Pierson at microsoft.com> wrote: > > > > Ken Levy from the Visual Studio extensibility team just blogged about > > the 1.0 new release of IronPython Studio ( > > http://codeplex.com/IronPythonStudio). As is pointed out below, this new > > version supports the integrated VS08 Shell, which means that if you already > > have VS08 installed, IPy Studio will just snap right into it. If you don't > > have VS08, you can download the VS08 shell for free (directions on the site) > > > > > > > > Harry Pierson > > > > PM, IronPython > > > > harry.pierson at microsoft.com > > > > http://devhawk.net > > > > > > > > > > > > > > > > > > > > > > http://blogs.msdn.com/vsxteam/archive/2008/03/31/ironpython-studio-1-0-for-isolated-and-integrated-vs-shell.aspx > > > > > > > > IronPython is now available in for both integrated and isolated VS > > Shell, see blog post for details. > > > > > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From janrou at gmail.com Sun Apr 6 12:55:57 2008 From: janrou at gmail.com (Pjerrot) Date: Sun, 6 Apr 2008 03:55:57 -0700 (PDT) Subject: [IronPython] Problem with 3 modules, classes and missing attributes In-Reply-To: <47F815BE.9000607@voidspace.org.uk> References: <19659a43-4f01-44d8-8efb-ab69d94cb9e0@q10g2000prf.googlegroups.com> <47F815BE.9000607@voidspace.org.uk> Message-ID: <6896dbc8-8bad-475e-98cc-e5db59452c87@c65g2000hsa.googlegroups.com> Thank you for the answer! I conclude, that I have to read up carefully on python modules and imports. Yes! IronPython studio generates really bad code. The studio is not at all mature. Serious refactoring have to be done, before it is a good start point for Python beginners like me. This is the third major issue I encountered using IronPython Studio. First it uses __slots__. You can not add variables to the form class and keep to design the form. The __slots__ content is only and only for the the added window controls. Secondly it has confused me about import and bad namespace structuring using classes. Thirdly the editor creates compiler errors .The tabs are not handled carefully, so the editor shows wrong indents resulting in indention compiler errors. The problem became smaller after I set up all tabs to be spaces and set the tabs to 60 spaces. Then it was easy to see, where the bad tabulated indents were. An upcoming issue is the appartment model for ActiveX and COM- components. I have seen flashes of error messages notifying about wrong appartment for the webbrowser control. It came, when I try to start a worker thread beside the main window thread running Application.Run(..). The project and file handling is as usual excellent for Visual Studio's and you can very easy design windows form layouts. I copy the form designs to another python console application project deleting the __slots__, namespace classes and review the imports. The studio is a magnet for beginners used to work with Visual Studio for Basic, C# and other language. I have posted these isues to the IronPython project on Codeplex. Regards Pjerrot On 6 Apr., 02:13, Michael Foord wrote: > Hello Pjerrot, > > Unfortunately the layout of code created by Visual Studio IronPython (do > you mean IronPython Studio or Visual Studio Professional?) is a > *terrible* way to write Python. > > It effectively matches the semantics of C#, but you should not replicate > it yourself - do not contain your classes inside a namespace class. > Additionally, do not use the 'from XXX import *' - but instead > explicitly import the names you want to use. > > I don't say the last point out of dogma - I think if you make that > change you will immediately see what is wrong with the code. > > All the best, > > Michael Foordhttp://www.ironpythoninaction.com/ > > > From janrou at gmail.com Sun Apr 6 12:59:47 2008 From: janrou at gmail.com (Pjerrot) Date: Sun, 6 Apr 2008 03:59:47 -0700 (PDT) Subject: [IronPython] how to use IronPython 2.0 beta in IronPython Studio 1.0 In-Reply-To: <41d7f4a90804051757y5ba5860v4a782fa2ebba6622@mail.gmail.com> References: <41d7f4a90804051757y5ba5860v4a782fa2ebba6622@mail.gmail.com> Message-ID: Don't! The studio is not mature. So let the studio mature a bit more regarding python code generation. Use your time more productive. The windows form design and project handling from the studio is excellent, but keep the python code generated by the studio at a minimum. Regards Pjerrot On 6 Apr., 02:57, "Kevin Chu" wrote: > I found IronPython Studio 1.0 use IronPython 1.1, and how to use IronPython > 2.0 beta in IronPython Studio 1.0? > > -- > Once in a Redmoon > > _______________________________________________ > Users mailing list > Us... at lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com From ben2004uk at googlemail.com Sun Apr 6 13:38:36 2008 From: ben2004uk at googlemail.com (Ben Hall) Date: Sun, 6 Apr 2008 12:38:36 +0100 Subject: [IronPython] FW: IronPython Studio 1.0 for Isolated and Integrated VS Shell In-Reply-To: <2fd6b9d0804060137teebea7ei9ec4446a5f3457bc@mail.gmail.com> References: <2fd6b9d0804050235j6cdf0218y60cff76245818258@mail.gmail.com> <2fd6b9d0804060134s1930a390n22fded21c2f48d5a@mail.gmail.com> <2fd6b9d0804060137teebea7ei9ec4446a5f3457bc@mail.gmail.com> Message-ID: The VS2008 SDK Sample integration supports ASP.net + IronPython. Sadly it looks like this hasn't been done in IPy Studio. Ben Blog.BenHall.me.uk On Sun, Apr 6, 2008 at 9:37 AM, Ronnie Maor wrote: > forgot to mention that I'm using IPy 1.1.1 > > > > On Sun, Apr 6, 2008 at 11:34 AM, Ronnie Maor wrote: > > two answers and some more info :-) > > > > 1) This is the first version IPy Studio version I've tried. I have VS2008 > Pro, and have been working with the VS SDK sample in the experimental hive. > The problem with the experimental hive is that we also have ReSharper and we > couldn't get ReSharper to work in the hive or python support installed > outside the hive, so we now have two IDEs. > > So when I saw your post on IPy Studio integrated mode, I decided to try it > as a way to ditch the experimental hive. > > I installed using the binary integrated mode setup file (using all > defaults), and then just tried to load my current solution and got the error > message. > > > > I assumed that since IPy Studio was based on the sample it could just run > my current solution with projects created with the sample in the > experimental hive. Right now I'm guessing this is where I was wrong. > > > > 2) My python projects are class libraries, not web apps. The solution > contains other projects which are C# libraries and a web app (ASP.NET in > C#), but as far as I understand that shouldn't affect IPy Studio's ability > to load my python project (?) > > > > I just tried creating a new solution with VS2008 + IPy Studio and creating > python class libraries in it. This seems to work. > > Copying the files from my previous project and re-adding them to a new > project also worked (although I didn't import all the files/directories yet) > > Copying the files + the project and trying to add the existing project > failed again in the new solution with the same error. > > > > So now I have one configuration that seems to work and another that > doesn't. I'll try building it the way that works and comparing the project > files and hopefully will find what the difference is, and how to solve it, > and post that here. > > > > However, if someone knows what the answer is already - please let me know > :-) > > > > thanks > > Ronnie > > > > > > > > > > > > On Sun, Apr 6, 2008 at 12:12 AM, Harry Pierson > wrote: > > > > > > > > > > > > > > > > > Two questions: > > > > > > > > > > > > 1. Did it work before with the previous IPy Studio? > > > > > > 2. Is it a web app? The URL you included related to web apps, and > AFAIK IPy Studio doesn't include web app development support. > > > > > > > > > > > > Harry > > > > > > > > > > > > > > > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ronnie Maor > > > Sent: Saturday, April 05, 2008 2:35 AM > > > To: Discussion of IronPython > > > Subject: Re: [IronPython] FW: IronPython Studio 1.0 for Isolated and > Integrated VS Shell > > > > > > > > > > > > > > > > > > > > > this sounds great - integration with VS2008 will be much better than > running with the experimental hive. > > > > > > however, after installing, my python projects failed to load, with the > following error: > > > "could not find any resources appropriate for the specified culture or > neutral culture..." (see attached screenshot). > > > > > > also found this blog entry which sounds relevent: > > > http://weblogs.asp.net/ngur/archive/2003/12/28/46219.aspx > > > > > > hoping this post will make it to someone who can fix the problem, or let > me know how to work around it... > > > > > > thanks > > > Ronnie > > > > > > > > > On Tue, Apr 1, 2008 at 2:36 AM, Harry Pierson > wrote: > > > > > > > > > > > > Ken Levy from the Visual Studio extensibility team just blogged about > the 1.0 new release of IronPython Studio > (http://codeplex.com/IronPythonStudio). As is pointed out below, this new > version supports the integrated VS08 Shell, which means that if you already > have VS08 installed, IPy Studio will just snap right into it. If you don't > have VS08, you can download the VS08 shell for free (directions on the site) > > > > > > > > > > > > Harry Pierson > > > > > > PM, IronPython > > > > > > harry.pierson at microsoft.com > > > > > > http://devhawk.net > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://blogs.msdn.com/vsxteam/archive/2008/03/31/ironpython-studio-1-0-for-isolated-and-integrated-vs-shell.aspx > > > > > > > > > > > > IronPython is now available in for both integrated and isolated VS > Shell, see blog post for details. > > > > > > > > > > > > > > > _______________________________________________ > > > Users mailing list > > > Users at lists.ironpython.com > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > _______________________________________________ > > > Users mailing list > > > Users at lists.ironpython.com > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From daftspaniel at gmail.com Sun Apr 6 14:55:35 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Sun, 6 Apr 2008 13:55:35 +0100 Subject: [IronPython] False? with Unit Test In-Reply-To: References: <20253b0c0804050606v323038c7l1f91f06764e68901@mail.gmail.com> <47F7B51D.8060905@voidspace.org.uk> Message-ID: <20253b0c0804060555o25052b1di1fccd67e3754567e@mail.gmail.com> Thanks for all that. Surprised it got so complicated. Wondering if you guys ever sleep!! :-) Davy On Sun, Apr 6, 2008 at 12:24 AM, Curt Hagenlocher wrote: > On Sat, Apr 5, 2008 at 10:21 AM, Michael Foord > wrote: > > > > As bool inherits from int, calling 'sys.exit' with False ought to be > > exactly the equivalent of calling it with 0. (False == 0, True == 1). > > SystemExitException.GetExitCode calls TypeCache.Int32.IsInstanceOfType > with the argument to the exit function, and this function returns > false when the type of the argument is System.Boolean. > > In other words, this discrepancy happens because > TypeCache.Int32.IsInstanceOfType(false) == false > TypeCache.Int32.IsInstanceOfType(4) == true > > Interestingly, a user-defined type that derives from "int" produces > the correct response. > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinjvinj at gmail.com Sun Apr 6 15:21:54 2008 From: vinjvinj at gmail.com (Vineet Jain (gmail)) Date: Sun, 6 Apr 2008 09:21:54 -0400 Subject: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight Message-ID: <003e01c897e9$301c14e0$90543ea0$@com> I'm building my first silverlight application and wanted to use a good templating library (preppy from reportlab http://www.reportlab.org/downloads.html ) in ironpython. The main problem that I'm having now is with import py_compile py_compile.compile(srcFileName, cfile=directory + os.sep + name + '.pyc', dfile=name + '.py') When I try to import py_compile from python it fails. Is there any way to compile and load a python source file from a text string and not have to save the file to the filesystem? Thanks, Vineet -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Sun Apr 6 15:27:06 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 06 Apr 2008 14:27:06 +0100 Subject: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight In-Reply-To: <003e01c897e9$301c14e0$90543ea0$@com> References: <003e01c897e9$301c14e0$90543ea0$@com> Message-ID: <47F8CFAA.6030008@voidspace.org.uk> Vineet Jain (gmail) wrote: > > I?m building my first silverlight application and wanted to use a good > templating library (preppy from reportlab > http://www.reportlab.org/downloads.html ) in ironpython. The main > problem that I?m having now is with > > import py_compile > > py_compile.compile(srcFileName, > > cfile=directory + os.sep + name + '.pyc', > > dfile=name + '.py') > > When I try to import py_compile from python it fails. Is there any way > to compile and load a python source file from a text string and not > have to save the file to the filesystem? > I'm not familiar with preppy - but IronPython doesn't support loading or saving compiled Python bytecode files (IronPython uses a different bytecode format altogether). You also can't write to the filesystem from Silverlight. You can read files that are contained in the '.xap' file (your dynamic application) - but you have to use 'file' rather than 'open'. I'm afraid you will actually have to dig into "py_compile.compile" to see if there is a workaround what it is trying to do. Michael Foord http://www.ironpythoninaction.com/ > Thanks, > > Vineet > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From vinjvinj at gmail.com Sun Apr 6 19:14:38 2008 From: vinjvinj at gmail.com (Vineet Jain (gmail)) Date: Sun, 6 Apr 2008 13:14:38 -0400 Subject: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight In-Reply-To: <47F8CFAA.6030008@voidspace.org.uk> References: <003e01c897e9$301c14e0$90543ea0$@com> <47F8CFAA.6030008@voidspace.org.uk> Message-ID: <004901c89809$b27ccc70$17766550$@com> >>I'm not familiar with preppy - but IronPython doesn't support loading or >>saving compiled Python bytecode files (IronPython uses a different >>bytecode format altogether). But that is not the problem. If I have the following string python_source = """ def function test_dynamic(): return 1 """ How do I load this function at run time and be able to call the function Some_module.test_dynamic(), also more importantly, can this be done in Silverlight? >>You also can't write to the filesystem from Silverlight. You can read >>files that are contained in the '.xap' file (your dynamic application) - >>but you have to use 'file' rather than 'open'. I'm less worried about this, since I can modify the preppy module so that the File system is not needed. From curt at hagenlocher.org Sun Apr 6 19:49:03 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 6 Apr 2008 10:49:03 -0700 Subject: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight In-Reply-To: <004901c89809$b27ccc70$17766550$@com> References: <003e01c897e9$301c14e0$90543ea0$@com> <47F8CFAA.6030008@voidspace.org.uk> <004901c89809$b27ccc70$17766550$@com> Message-ID: On Sun, Apr 6, 2008 at 10:14 AM, Vineet Jain (gmail) wrote: > > But that is not the problem. If I have the following string > > python_source = """ > def function test_dynamic(): > return 1 > """ > > How do I load this function at run time and be able to call the function > Some_module.test_dynamic()? Here's an example that may help you: import imp import sys python_source = """ def test_dynamic(): return 1 """ module = imp.new_module('some_module') sys.modules['some_module'] = module exec python_source in module.__dict__ from some_module import test_dynamic print test_dynamic() You can "exec" a string against any dictionary; you don't actually need a module to do it. -- Curt Hagenlocher curt at hagenlocher.org From vinjvinj at gmail.com Mon Apr 7 00:57:49 2008 From: vinjvinj at gmail.com (Vineet Jain (gmail)) Date: Sun, 6 Apr 2008 18:57:49 -0400 Subject: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight In-Reply-To: <47F8CFAA.6030008@voidspace.org.uk> References: <003e01c897e9$301c14e0$90543ea0$@com> <47F8CFAA.6030008@voidspace.org.uk> Message-ID: <004d01c89839$a3c0d2a0$eb4277e0$@com> The following code is in preppy to give syntax errors in the templates: import traceback tb = traceback.format_tb(tb) tb = string.join(tb, "\n") # how to get the line in the script for the error? raise ValueError, "bad script code for %s\n%s\n\n%s\n%s\n%s" % ( compilemode, ddblock, t, v, tb) ironpython does not have the module traceback. Is there some other way to do this? Thanks, Vineet From fuzzyman at voidspace.org.uk Mon Apr 7 00:59:39 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Sun, 06 Apr 2008 23:59:39 +0100 Subject: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight In-Reply-To: <004d01c89839$a3c0d2a0$eb4277e0$@com> References: <003e01c897e9$301c14e0$90543ea0$@com> <47F8CFAA.6030008@voidspace.org.uk> <004d01c89839$a3c0d2a0$eb4277e0$@com> Message-ID: <47F955DB.3010501@voidspace.org.uk> Vineet Jain (gmail) wrote: > The following code is in preppy to give syntax errors in the templates: > > import traceback > tb = traceback.format_tb(tb) > tb = string.join(tb, "\n") > # how to get the line in the script for the error? > raise ValueError, "bad script code for %s\n%s\n\n%s\n%s\n%s" % ( > compilemode, ddblock, t, v, tb) > > ironpython does not have the module traceback. Is there some other way to do > this? > The traceback module works fine with IronPython. You have to make sure it (and preferably the whole Python standard library) is on your path. Michael Foord http://www.ironpythoninaction.com > Thanks, > > Vineet > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From ben2004uk at googlemail.com Mon Apr 7 01:54:44 2008 From: ben2004uk at googlemail.com (Ben Hall) Date: Mon, 7 Apr 2008 00:54:44 +0100 Subject: [IronPython] Lamba Expressions in IronPython Message-ID: Hi everyone, Just been playing around with C# and IronPython interop and I wanted to define a lambda expression. My CLR object is just a wrapper around a generic list (as generics aren't supported?) public class GenericWrapper : List {} I tried to do a lamba expression to pull back a item from the collection, however I got the following exception: >>> i = GenericWrapper() >>> i.Add(1) >>> i.Add(2) >>> i.Add(3) >>> v = i.Find(item => item == 1) File "", line 1 v = i.Find(item => item == 1) ^ SyntaxError: unexpected token '>' I guess I can use a method\delegate like in C# 2.0, but is there any way to do anything like Lamba Expressions? Or is there something similar in Python? Any help would be great. Thanks Ben Blog.BenHall.me.uk From curt at hagenlocher.org Mon Apr 7 02:01:10 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 6 Apr 2008 17:01:10 -0700 Subject: [IronPython] Lamba Expressions in IronPython In-Reply-To: References: Message-ID: On Sun, Apr 6, 2008 at 4:54 PM, Ben Hall wrote: > > My CLR object is just a wrapper around a generic list (as generics > aren't supported?) Sure they are. import System from System.Collections.Generic import List i = List[int]() > I guess I can use a method\delegate like in C# 2.0, but is there any > way to do anything like Lamba Expressions? Or is there something > similar in Python? Yes, lambda expressions have been a part of Python since the early days. They use the "lambda" keyword. i = List[int]() i.Add(1) i.Add(2) i.Add(3) v = i.Find(lambda obj: obj == 1) -- Curt Hagenlocher curt at hagenlocher.org From slide.o.mix at gmail.com Mon Apr 7 02:02:04 2008 From: slide.o.mix at gmail.com (Slide) Date: Sun, 6 Apr 2008 17:02:04 -0700 Subject: [IronPython] Lamba Expressions in IronPython In-Reply-To: References: Message-ID: Generics are indeed supported. mylist = List[int]() also, python has had lambdas for a long time now. try x = mylist.Find(x : x == 1) slide On Sun, Apr 6, 2008 at 4:54 PM, Ben Hall wrote: > Hi everyone, > > Just been playing around with C# and IronPython interop and I wanted > to define a lambda expression. > > My CLR object is just a wrapper around a generic list (as generics > aren't supported?) > > public class GenericWrapper : List > {} > > I tried to do a lamba expression to pull back a item from the > collection, however I got the following exception: > >>> i = GenericWrapper() > >>> i.Add(1) > >>> i.Add(2) > >>> i.Add(3) > >>> v = i.Find(item => item == 1) > File "", line 1 > v = i.Find(item => item == 1) > ^ > SyntaxError: unexpected token '>' > > I guess I can use a method\delegate like in C# 2.0, but is there any > way to do anything like Lamba Expressions? Or is there something > similar in Python? > > Any help would be great. > > Thanks > > Ben > Blog.BenHall.me.uk > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- slide-o-blog http://slide-o-blog.blogspot.com/ From fuzzyman at voidspace.org.uk Mon Apr 7 02:03:21 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 07 Apr 2008 01:03:21 +0100 Subject: [IronPython] Lamba Expressions in IronPython In-Reply-To: References: Message-ID: <47F964C9.80000@voidspace.org.uk> Ben Hall wrote: > Hi everyone, > > Just been playing around with C# and IronPython interop and I wanted > to define a lambda expression. > > My CLR object is just a wrapper around a generic list (as generics > aren't supported?) > > public class GenericWrapper : List > {} > > I tried to do a lamba expression to pull back a item from the > collection, however I got the following exception: > >>>> i = GenericWrapper() >>>> i.Add(1) >>>> i.Add(2) >>>> i.Add(3) >>>> v = i.Find(item => item == 1) >>>> > File "", line 1 > v = i.Find(item => item == 1) > lambda item: item == 1 In general, arbitrary C# syntax doesn't "just work" with IronPython and you have to stick to Python syntax. ;-) (However, if "Find" expects a particular type of delegate you may have to use CallTarget0 or create a delegate). Michael http://www.ironpythoninaction.com > ^ > SyntaxError: unexpected token '>' > > I guess I can use a method\delegate like in C# 2.0, but is there any > way to do anything like Lamba Expressions? Or is there something > similar in Python? > > Any help would be great. > > Thanks > > Ben > Blog.BenHall.me.uk > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From ben2004uk at googlemail.com Mon Apr 7 02:26:57 2008 From: ben2004uk at googlemail.com (Ben Hall) Date: Mon, 7 Apr 2008 01:26:57 +0100 Subject: [IronPython] Lamba Expressions in IronPython In-Reply-To: <47F964C9.80000@voidspace.org.uk> References: <47F964C9.80000@voidspace.org.uk> Message-ID: Thank you for all the answers, made everything make a lot more sense :) Cheers Ben On Mon, Apr 7, 2008 at 1:03 AM, Michael Foord wrote: > Ben Hall wrote: > > Hi everyone, > > > > Just been playing around with C# and IronPython interop and I wanted > > to define a lambda expression. > > > > My CLR object is just a wrapper around a generic list (as generics > > aren't supported?) > > > > public class GenericWrapper : List > > {} > > > > I tried to do a lamba expression to pull back a item from the > > collection, however I got the following exception: > > > >>>> i = GenericWrapper() > >>>> i.Add(1) > >>>> i.Add(2) > >>>> i.Add(3) > >>>> v = i.Find(item => item == 1) > >>>> > > File "", line 1 > > v = i.Find(item => item == 1) > > > > lambda item: item == 1 > > In general, arbitrary C# syntax doesn't "just work" with IronPython and > you have to stick to Python syntax. ;-) > > (However, if "Find" expects a particular type of delegate you may have > to use CallTarget0 or create a delegate). > > Michael > http://www.ironpythoninaction.com > > > ^ > > SyntaxError: unexpected token '>' > > > > I guess I can use a method\delegate like in C# 2.0, but is there any > > way to do anything like Lamba Expressions? Or is there something > > similar in Python? > > > > Any help would be great. > > > > Thanks > > > > Ben > > Blog.BenHall.me.uk > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From vinjvinj at gmail.com Mon Apr 7 05:31:27 2008 From: vinjvinj at gmail.com (Vineet Jain (gmail)) Date: Sun, 6 Apr 2008 23:31:27 -0400 Subject: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight In-Reply-To: <47F955DB.3010501@voidspace.org.uk> References: <003e01c897e9$301c14e0$90543ea0$@com> <47F8CFAA.6030008@voidspace.org.uk> <004d01c89839$a3c0d2a0$eb4277e0$@com> <47F955DB.3010501@voidspace.org.uk> Message-ID: <005a01c8985f$ddcace30$99606a90$@com> Thanks to all the responses I was able to get preppy to work with ironpython and silverlight. One question I have is that currently to get this working in silverlight I have to copy the string and traceback module to the app folder. Is there any way for the Chiron app to automatically extract the modules that I need or can I specify them somewhere else instead of having to move them to the app folder? Thanks, Vineet -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Sunday, April 06, 2008 7:00 PM To: Discussion of IronPython Subject: Re: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight Vineet Jain (gmail) wrote: > The following code is in preppy to give syntax errors in the templates: > > import traceback > tb = traceback.format_tb(tb) > tb = string.join(tb, "\n") > # how to get the line in the script for the error? > raise ValueError, "bad script code for %s\n%s\n\n%s\n%s\n%s" % ( > compilemode, ddblock, t, v, tb) > > ironpython does not have the module traceback. Is there some other way to do > this? > The traceback module works fine with IronPython. You have to make sure it (and preferably the whole Python standard library) is on your path. Michael Foord http://www.ironpythoninaction.com > Thanks, > > Vineet > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Apr 7 16:10:29 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 07 Apr 2008 15:10:29 +0100 Subject: [IronPython] Trying to use the library preppy from reportlib in ironpython and silverlight In-Reply-To: <005a01c8985f$ddcace30$99606a90$@com> References: <003e01c897e9$301c14e0$90543ea0$@com> <47F8CFAA.6030008@voidspace.org.uk> <004d01c89839$a3c0d2a0$eb4277e0$@com> <47F955DB.3010501@voidspace.org.uk> <005a01c8985f$ddcace30$99606a90$@com> Message-ID: <47FA2B55.5060300@voidspace.org.uk> Vineet Jain (gmail) wrote: > Thanks to all the responses I was able to get preppy to work with ironpython > and silverlight. One question I have is that currently to get this working > in silverlight I have to copy the string and traceback module to the app > folder. Is there any way for the Chiron app to automatically extract the > modules that I need or can I specify them somewhere else instead of having > to move them to the app folder? > > They need to be in the app folder for Silverlight to be able to import them - so the short answer is no. :-) Dependency tracking for Python modules is a difficult problem and there are Python modules (in the standard library and in projects like py2exe) that do just this. It is unrealistic to expect Silverlight to implement these semantics - especially as it is a tool for Dynamic Silverlight in general and not just for Python. Michael http://www.ironpythoninaction.com/ > Thanks, > > Vineet > > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, April 06, 2008 7:00 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Trying to use the library preppy from reportlib in > ironpython and silverlight > > Vineet Jain (gmail) wrote: > >> The following code is in preppy to give syntax errors in the templates: >> >> import traceback >> tb = traceback.format_tb(tb) >> tb = string.join(tb, "\n") >> # how to get the line in the script for the error? >> raise ValueError, "bad script code for %s\n%s\n\n%s\n%s\n%s" % ( >> compilemode, ddblock, t, v, tb) >> >> ironpython does not have the module traceback. Is there some other way to >> > do > >> this? >> >> > > The traceback module works fine with IronPython. You have to make sure > it (and preferably the whole Python standard library) is on your path. > > Michael Foord > http://www.ironpythoninaction.com > > >> Thanks, >> >> Vineet >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dfugate at microsoft.com Mon Apr 7 17:47:55 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Mon, 7 Apr 2008 08:47:55 -0700 Subject: [IronPython] False? with Unit Test In-Reply-To: References: <20253b0c0804050606v323038c7l1f91f06764e68901@mail.gmail.com> Message-ID: <7346A825E148B049A9AD1D3ED46A2D91259F54A9F9@NA-EXMSG-C106.redmond.corp.microsoft.com> Thanks for reporting this! I believe we do already have an internal bug report on this, and I've now created a public bug on CodePlex (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15972) so it can be voted on. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Saturday, April 05, 2008 10:16 AM To: Discussion of IronPython Subject: Re: [IronPython] False? with Unit Test It's the call to sys.exit that does this. There's a subtle difference between IronPython 2.0B1 and CPython 2.5 when sys.exit is called with a boolean parameter. CPython doesn't print the value of the parameter if it's boolean, while IronPython does. Presumably, CPython does this for backwards compatibility with a time when it didn't have a boolean data type. I'd guess that sys.exit(False) gets the same behavior as sys.exit(0) while sys.exit(True) is the same as sys.exit(1). But I haven't checked the CPython source to confirm that guess. On Sat, Apr 5, 2008 at 6:06 AM, Davy Mitchell > wrote: Hello List, Found a little funny on the latest IPY. import unittest class ATest(unittest.TestCase): def setUp(self): self.pop = "" def test_blog(self): print "test" if __name__ == '__main__': unittest.main() Runs fine but under IPY there's a extra line with 'False' output: test . -------------------------------------------------------------- Ran one test in 0.096s OK False Anyone had more experience with this module? Davy -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Mon Apr 7 18:54:56 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 07 Apr 2008 17:54:56 +0100 Subject: [IronPython] ctypes.py from FePy Message-ID: <47FA51E0.8060102@voidspace.org.uk> Hello all, I've been trying to use ctypes.py from FePy for dynamic platform invoke. Unfortunately it doesn't appear to work... I'm trying to follow the example at: http://www.ironpython.info/index.php/Access_Unmanaged_Code_with_Dynamic_P/Invoke Unfortunately 'WDLL' doesn't exist in ctypes. If I replace it with 'CDLL' it blows up with the following error: >>> usr = pinvoke.CDLL("user32.dll") >>> WM_KEYDOWN = 0x100 >>> HWND_BROADCAST = 0xFFFF >>> usr.PostMessage(HWND_BROADCAST, WM_KEYDOWN, ord('a'), 0) Traceback (most recent call last): File , line 0, in ##88 File pinvoke, line unknown, in __call__ File e:\Dev\ironpython1\pinvoke.py, line 173, in __call__ SystemError: Object reference not set to an instance of an object. Anyone got any ideas? I'm using it with IronPython 1.1 as ctypes needs modifying slightly for IP 2. Thanks Michael Foord http://www.ironpythoninaction.com/ From daftspaniel at gmail.com Mon Apr 7 22:31:50 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Mon, 7 Apr 2008 21:31:50 +0100 Subject: [IronPython] False? with Unit Test In-Reply-To: <7346A825E148B049A9AD1D3ED46A2D91259F54A9F9@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <20253b0c0804050606v323038c7l1f91f06764e68901@mail.gmail.com> <7346A825E148B049A9AD1D3ED46A2D91259F54A9F9@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <20253b0c0804071331l13a26332tbdba66990a466@mail.gmail.com> Thanks Dave. Doesn't impact me me right now so I won't vote :-) !! On Mon, Apr 7, 2008 at 4:47 PM, Dave Fugate wrote: > Thanks for reporting this! I believe we do already have an internal bug > report on this, and I've now created a public bug on CodePlex ( > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=15972) so > it can be voted on. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Curt Hagenlocher > *Sent:* Saturday, April 05, 2008 10:16 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] False? with Unit Test > > > > It's the call to sys.exit that does this. > > There's a subtle difference between IronPython 2.0B1 and CPython 2.5 when > sys.exit is called with a boolean parameter. CPython doesn't print the > value of the parameter if it's boolean, while IronPython does. Presumably, > CPython does this for backwards compatibility with a time when it didn't > have a boolean data type. I'd guess that sys.exit(False) gets the same > behavior as sys.exit(0) while sys.exit(True) is the same as sys.exit(1). > But I haven't checked the CPython source to confirm that guess. > > On Sat, Apr 5, 2008 at 6:06 AM, Davy Mitchell > wrote: > > Hello List, > > Found a little funny on the latest IPY. > > import unittest > > class ATest(unittest.TestCase): > def setUp(self): > self.pop = "" > def test_blog(self): > print "test" > > if __name__ == '__main__': > unittest.main() > > Runs fine but under IPY there's a extra line with 'False' output: > > test > . > -------------------------------------------------------------- > Ran one test in 0.096s > > OK > False > > Anyone had more experience with this module? > > Davy > > -- > Davy Mitchell > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > Twitter - http://twitter.com/daftspaniel > Skype - daftspaniel http://needgod.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Mon Apr 7 23:15:36 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 07 Apr 2008 22:15:36 +0100 Subject: [IronPython] Syntax Error (or not) Message-ID: <47FA8EF8.20500@voidspace.org.uk> Difference in handling of an incomplete statement at the interactive interpreter (I think this is biting me as I implement an interactive interpreter in the browser and I *think* it is unrelated to previous related bugs we have discussed!). The first (incomplete) statement should raise a SyntaxError immediately: C:\Users\Administrator>python Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> os. File "", line 1 os. ^ SyntaxError: invalid syntax >>> C:\Users\Administrator>e:\Dev\ironpython2\ipy.exe IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1434 Copyright (c) Microsoft Corporation. All rights reserved. >>> os. ... ss File "", line 1 os. ^ SyntaxError: unexpected token '' >>> Michael Foord http://www.ironpythoninaction.com/ From pburrows at gmail.com Tue Apr 8 00:58:55 2008 From: pburrows at gmail.com (Patrick Burrows) Date: Mon, 7 Apr 2008 18:58:55 -0400 Subject: [IronPython] Modifying Parameters Message-ID: <2b5416590804071558m7098004drb0fb24589d25948e@mail.gmail.com> Perhaps a simple question, but I am having problems finding the answer. I am hosting IronPython (1.1.1) in a C# application. My IronPython method modifies the parameters passed to the method (out int). I would very much like to get those modified values back. Here is my sample: //C# method that calls the PythonEngine: PythonEngine pe = new PythonEngine(); EngineModule em = pe.CreateModule("PreCalc",true); string[] paramnames = {"number1", "number2"}; PreCalcMacro pcMac = pe.CreateMethod(GetPreCalcSourceUnitString(), paramnames, em); pcMac(out firstNumber, out secondNumber); Number1TextBox.Text = firstNumber.ToString(); Number2TextBox.Text = secondNumber.ToString(); //My delegate definition: delegate void PreCalcMacro(out int n1, out int n2); //My IronPython code (the return value of GetPreCalcSourceUnitString() ): number1 = 2 number2 = 3 Now, after this code executes, the values of firstNumber and secondNumber remain unchanged. What do I need to do to have these values update to what the python method set them to? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From pburrows at gmail.com Tue Apr 8 01:19:42 2008 From: pburrows at gmail.com (Patrick Burrows) Date: Mon, 7 Apr 2008 19:19:42 -0400 Subject: [IronPython] Modifying Parameters In-Reply-To: <2b5416590804071558m7098004drb0fb24589d25948e@mail.gmail.com> References: <2b5416590804071558m7098004drb0fb24589d25948e@mail.gmail.com> Message-ID: <2b5416590804071619k20ca41bbq24c3e89e3dcde977@mail.gmail.com> nevermind. figured it out. (of course) need ".Value" on my python. So the simple python becomes: number1.Value = 2 number2.Value = 3 (duh!... looking for the problem in all the wrong places) On Mon, Apr 7, 2008 at 6:58 PM, Patrick Burrows wrote: > Perhaps a simple question, but I am having problems finding the answer. I > am hosting IronPython (1.1.1) in a C# application. My IronPython method > modifies the parameters passed to the method (out int). I would very much > like to get those modified values back. Here is my sample: > > //C# method that calls the PythonEngine: > PythonEngine pe = new PythonEngine(); > EngineModule em = pe.CreateModule("PreCalc",true); > string[] paramnames = {"number1", "number2"}; > PreCalcMacro pcMac = > pe.CreateMethod(GetPreCalcSourceUnitString(), paramnames, em); > pcMac(out firstNumber, out secondNumber); > Number1TextBox.Text = firstNumber.ToString(); > Number2TextBox.Text = secondNumber.ToString(); > > > //My delegate definition: > delegate void PreCalcMacro(out int n1, out int n2); > > //My IronPython code (the return value of GetPreCalcSourceUnitString() ): > number1 = 2 > number2 = 3 > > Now, after this code executes, the values of firstNumber and secondNumber > remain unchanged. > What do I need to do to have these values update to what the python method > set them to? > > Thanks! > > -- -- Patrick Burrows http://www.CleverHumans.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinjvinj at gmail.com Tue Apr 8 04:27:52 2008 From: vinjvinj at gmail.com (Vineet Jain (gmail)) Date: Mon, 7 Apr 2008 22:27:52 -0400 Subject: [IronPython] Having problems calling javascript from ironpython in silverlight Message-ID: <00d201c89920$26b18330$74148990$@com> I can call from javascript to python but cannot call from python to javascript. I get the error on my onload function that I'm trying to access a property (callToJsWithString) which does not exist. I've included a test template for python and javascript code. Any help would be appreciated. Python Code:------------------------> import clr clr.AddReference("Scriptable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null") from Scriptable import ( Scriptable, ScriptableForString, ScriptableEvent, ScriptableEventArgs ) import sys from System.Windows.Browser.HtmlPage import Document import System.Windows.Browser.HtmlPage as HtmlPage #calling javascript function from python callToJsWithString = ScriptableEvent() #calling python from javascript class CallFromJs(ScriptableForString): def _method(self, code): Document.value_from_python.innerHTML = code callFromJs = CallFromJs() class CallFromJs2(ScriptableForString): def _method(self, code): args = ScriptableEventArgs() args.code = "calling javascript from python" callToJsWithString.OnEvent(args) callFromJs2 = CallFromJs2() HtmlPage.RegisterScriptableObject("callFromJs", callFromJs) HtmlPage.RegisterScriptableObject("callFromJs2", callFromJs2) HtmlPage.RegisterScriptableObject("callToJsWithString", callToJsWithString) Javascript Code:------------------------> function callToJsWithString(s, e) { alert(e.code); }; function onload() { $('#value_from_python').html("after 1"); alert(document.getElementById("SilverlightControl").Content); document.getElementById("SilverlightControl").Content.callToJsWithString.Eve nt = callToJsWithString; $('#value_from_python').val("after 2"); }; var controlID = "SilverlightControl" Silverlight.createObjectEx({ source: "app.xap", parentElement: document.getElementById("SilverlightControlHost"), id: controlID, properties: { width:'1', height:'1', inplaceInstallPrompt: false, isWindowless: 'True', version:'1.1' }, events:{ onError:null, // OnError property value -- event-handler function name. onLoad:'onload'}, // OnLoad property value -- event-handler function name. initParams: "start=scan.py, debug=true" }); -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Tue Apr 8 05:21:02 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 7 Apr 2008 20:21:02 -0700 Subject: [IronPython] ctypes.py from FePy In-Reply-To: <47FA51E0.8060102@voidspace.org.uk> References: <47FA51E0.8060102@voidspace.org.uk> Message-ID: On Mon, Apr 7, 2008 at 9:54 AM, Michael Foord wrote: > > I've been trying to use ctypes.py from FePy for dynamic platform invoke. > Unfortunately it doesn't appear to work... The main problem appears to be that MethodTarget.CanOptimize in IronPython 1.1.1 assumes that the method will have a DeclaringType -- but a dynamically generated method isn't necessarily attached to a type. As such, it doesn't appear that this version of ctypes.py could have ever worked with IronPython 1.1.1. I haven't checked earlier versions of IronPython 1. By changing MethodTarget.CanOptimize in the IronPython source so that it returns false when mi.DeclaringType == null, I was able to make ctypes.py work. > Unfortunately 'WDLL' doesn't exist in ctypes. If I replace it with > 'CDLL' it blows up with the following error: Presumably, the difference between WDLL and CDLL was that the latter uses a calling convention of CallingConvention.Cdecl while the former would have used CallingConvention.Winapi. This is a pretty important difference! In general, I think that there's some really nice code in ctypes.py, but like all invocations of pInvoke, you definitely can't use it blindly. Your PostMessage would probably break on a 64-bit OS even if it weren't for the issues of the calling convention and the problem in MethodTarget.CanOptimize -- because in the proper definition of PostMessage, the second and third parameters are IntPtr, but ctypes.py would treat them as "int32" -- Curt Hagenlocher curt at hagenlocher.org From vinjvinj at gmail.com Tue Apr 8 14:48:40 2008 From: vinjvinj at gmail.com (Vineet Jain (gmail)) Date: Tue, 8 Apr 2008 08:48:40 -0400 Subject: [IronPython] Having problems calling javascript from ironpython in silverlight Message-ID: <00e301c89976$e3acc340$ab0649c0$@com> I found an easier way to call javascript from python and it worked the very first time: With string arg: HtmlPage.Window.Invoke("callToJsWithStringSimple2", "string passed from python") With no string arg: HtmlPage.Window.Invoke("callToJsWithStringSimple2") Is there any reason why you have to use all the scriptable stuff that Michael was using instead of the above? Vineet From: Vineet Jain (gmail) [mailto:vinjvinj at gmail.com] Sent: Monday, April 07, 2008 10:28 PM To: 'users at lists.ironpython.com' Subject: Having problems calling javascript from ironpython in silverlight I can call from javascript to python but cannot call from python to javascript. I get the error on my onload function that I'm trying to access a property (callToJsWithString) which does not exist. I've included a test template for python and javascript code. Any help would be appreciated. Python Code:------------------------> import clr clr.AddReference("Scriptable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null") from Scriptable import ( Scriptable, ScriptableForString, ScriptableEvent, ScriptableEventArgs ) import sys from System.Windows.Browser.HtmlPage import Document import System.Windows.Browser.HtmlPage as HtmlPage #calling javascript function from python callToJsWithString = ScriptableEvent() #calling python from javascript class CallFromJs(ScriptableForString): def _method(self, code): Document.value_from_python.innerHTML = code callFromJs = CallFromJs() class CallFromJs2(ScriptableForString): def _method(self, code): args = ScriptableEventArgs() args.code = "calling javascript from python" callToJsWithString.OnEvent(args) callFromJs2 = CallFromJs2() HtmlPage.RegisterScriptableObject("callFromJs", callFromJs) HtmlPage.RegisterScriptableObject("callFromJs2", callFromJs2) HtmlPage.RegisterScriptableObject("callToJsWithString", callToJsWithString) Javascript Code:------------------------> function callToJsWithString(s, e) { alert(e.code); }; function onload() { $('#value_from_python').html("after 1"); alert(document.getElementById("SilverlightControl").Content); document.getElementById("SilverlightControl").Content.callToJsWithString.Eve nt = callToJsWithString; $('#value_from_python').val("after 2"); }; var controlID = "SilverlightControl" Silverlight.createObjectEx({ source: "app.xap", parentElement: document.getElementById("SilverlightControlHost"), id: controlID, properties: { width:'1', height:'1', inplaceInstallPrompt: false, isWindowless: 'True', version:'1.1' }, events:{ onError:null, // OnError property value -- event-handler function name. onLoad:'onload'}, // OnLoad property value -- event-handler function name. initParams: "start=scan.py, debug=true" }); -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jimmy.Schementi at microsoft.com Tue Apr 8 15:58:28 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 8 Apr 2008 06:58:28 -0700 Subject: [IronPython] Having problems calling javascript from ironpython in silverlight In-Reply-To: <00e301c89976$e3acc340$ab0649c0$@com> Message-ID: To use "Scriptable" you'd need to mark the method you want to call with an [Scriptable] attribute. Since Python doesn't support attributes, you can't use that method from Python. However, using Invoke will work just fine, since it's simply an eval. ~js On 4/8/08 5:48 AM, "Vineet Jain (gmail)" wrote: I found an easier way to call javascript from python and it worked the very first time: With string arg: HtmlPage.Window.Invoke("callToJsWithStringSimple2", "string passed from python") With no string arg: HtmlPage.Window.Invoke("callToJsWithStringSimple2") Is there any reason why you have to use all the scriptable stuff that Michael was using instead of the above? Vineet From: Vineet Jain (gmail) [mailto:vinjvinj at gmail.com] Sent: Monday, April 07, 2008 10:28 PM To: 'users at lists.ironpython.com' Subject: Having problems calling javascript from ironpython in silverlight I can call from javascript to python but cannot call from python to javascript. I get the error on my onload function that I'm trying to access a property (callToJsWithString) which does not exist. I've included a test template for python and javascript code. Any help would be appreciated. Python Code:------------------------> import clr clr.AddReference("Scriptable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null") from Scriptable import ( Scriptable, ScriptableForString, ScriptableEvent, ScriptableEventArgs ) import sys from System.Windows.Browser.HtmlPage import Document import System.Windows.Browser.HtmlPage as HtmlPage #calling javascript function from python callToJsWithString = ScriptableEvent() #calling python from javascript class CallFromJs(ScriptableForString): def _method(self, code): Document.value_from_python.innerHTML = code callFromJs = CallFromJs() class CallFromJs2(ScriptableForString): def _method(self, code): args = ScriptableEventArgs() args.code = "calling javascript from python" callToJsWithString.OnEvent(args) callFromJs2 = CallFromJs2() HtmlPage.RegisterScriptableObject("callFromJs", callFromJs) HtmlPage.RegisterScriptableObject("callFromJs2", callFromJs2) HtmlPage.RegisterScriptableObject("callToJsWithString", callToJsWithString) Javascript Code:------------------------> function callToJsWithString(s, e) { alert(e.code); }; function onload() { $('#value_from_python').html("after 1"); alert(document.getElementById("SilverlightControl").Content); document.getElementById("SilverlightControl").Content.callToJsWithString.Event = callToJsWithString; $('#value_from_python').val("after 2"); }; var controlID = "SilverlightControl" Silverlight.createObjectEx({ source: "app.xap", parentElement: document.getElementById("SilverlightControlHost"), id: controlID, properties: { width:'1', height:'1', inplaceInstallPrompt: false, isWindowless: 'True', version:'1.1' }, events:{ onError:null, // OnError property value -- event-handler function name. onLoad:'onload'}, // OnLoad property value -- event-handler function name. initParams: "start=scan.py, debug=true" }); -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben2004uk at googlemail.com Tue Apr 8 23:52:41 2008 From: ben2004uk at googlemail.com (Ben Hall) Date: Tue, 8 Apr 2008 22:52:41 +0100 Subject: [IronPython] C# Extension Methods and IP B2 Message-ID: Hi everyone, Tonight I was going to write a blog post on C# Interop so I I was playing around a bit more with some of the new C# 3.0 features and I looked at Extension methods and I can't seem to get it to work with IP B2. My C# code is this: public static class POCOExt { public static void Print(this POCO poco) { Console.WriteLine(poco); Console.WriteLine(poco.Created); } } public class POCO { public DateTime Created { get; set; } public POCO() { Created = DateTime.Now; } } I drop that assembly into my DLLs folder, when using it in ipy it doesn't seem to be detecting the extension methods. After doing a dir on POCO, I expected to see the method Print. >>> from DLRInterop import * >>> p = POCO() >>> dir (p) ['Created', 'Equals', 'Finalize', 'GetHashCode', 'GetType', 'MemberwiseClone', 'ReferenceEquals', 'ToString', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'get_Created', 'set_Created'] >>> p.Print() Traceback (most recent call last): File , line unknown, in Initialize##48 AttributeError: 'POCO' object has no attribute 'Print' This appeared to work, but it does go against C# 3.0 and isn't a great approach.... >>> POCOExt.Print(p) DLRInterop.POCO 08/04/2008 22:43:59 Is there anything special I need to do to get this to work as I would expect, or is there something where to call the Extension Method you need to go to the extension class? Cheers Ben Blog.BenHall.me.uk From srivatsn at microsoft.com Wed Apr 9 00:23:19 2008 From: srivatsn at microsoft.com (Srivatsn Narayanan) Date: Tue, 8 Apr 2008 15:23:19 -0700 Subject: [IronPython] C# Extension Methods and IP B2 In-Reply-To: References: Message-ID: <3FA51E96F92363468CF062D992DC84681F89F0665F@NA-EXMSG-C106.redmond.corp.microsoft.com> Currently, it doesn't "just work". You will have to decorate your POCOExt with an ExtensionType attribute so: [assembly: ExtensionType(typeof(POCO), typeof(POCOExt))] Then from somewhere (python/c#) make this call: Microsoft.Scripting.Runtime.RuntimeHelpers.RegisterAssembly(typeof(POCOExt).Assembly); This goes through the assembly and loads up everything in POCOExt into POCO. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Hall Sent: Tuesday, April 08, 2008 2:53 PM To: Discussion of IronPython Subject: [IronPython] C# Extension Methods and IP B2 Hi everyone, Tonight I was going to write a blog post on C# Interop so I I was playing around a bit more with some of the new C# 3.0 features and I looked at Extension methods and I can't seem to get it to work with IP B2. My C# code is this: public static class POCOExt { public static void Print(this POCO poco) { Console.WriteLine(poco); Console.WriteLine(poco.Created); } } public class POCO { public DateTime Created { get; set; } public POCO() { Created = DateTime.Now; } } I drop that assembly into my DLLs folder, when using it in ipy it doesn't seem to be detecting the extension methods. After doing a dir on POCO, I expected to see the method Print. >>> from DLRInterop import * >>> p = POCO() >>> dir (p) ['Created', 'Equals', 'Finalize', 'GetHashCode', 'GetType', 'MemberwiseClone', 'ReferenceEquals', 'ToString', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'get_Created', 'set_Created'] >>> p.Print() Traceback (most recent call last): File , line unknown, in Initialize##48 AttributeError: 'POCO' object has no attribute 'Print' This appeared to work, but it does go against C# 3.0 and isn't a great approach.... >>> POCOExt.Print(p) DLRInterop.POCO 08/04/2008 22:43:59 Is there anything special I need to do to get this to work as I would expect, or is there something where to call the Extension Method you need to go to the extension class? Cheers Ben Blog.BenHall.me.uk _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Wed Apr 9 03:34:24 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 8 Apr 2008 18:34:24 -0700 Subject: [IronPython] C# Extension Methods and IP B2 In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C2227011DAFFE3B07@DF-GRTDANE-MSG.exchange.corp.microsoft.com> We don't yet really support extension methods except for the ones provided by a host using the DLR style extension methods. If you want to use those you need to just add: [assembly: ExtensionType(typeof(POCO), typeof(POCOExt))] And then call RuntimeHelpers.RegisterAssembly and pass in the declaring assembly. We should pick up the types after that. RuntimeHelpers.RegisterAssembly is not final API. It's likely to change in B2 as one of the last bug fixes to multi-runtime support. I don't know that we will support the C# 3.0 style extension attributes in the 2.0 timeframe. While we could presumably support it we'd be required to create every custom attribute on the 1st parameter of every method in an assembly. Therefore it may be more significant of a feature than we'd like to fit in during the betas because we'd have to do something more intelligent than that. Hopefully this work around will suffice - at least for your own extension types. And FYI I'm guessing you're probably using 2.0 B1 not B2 :). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Hall Sent: Tuesday, April 08, 2008 2:53 PM To: Discussion of IronPython Subject: [IronPython] C# Extension Methods and IP B2 Hi everyone, Tonight I was going to write a blog post on C# Interop so I I was playing around a bit more with some of the new C# 3.0 features and I looked at Extension methods and I can't seem to get it to work with IP B2. My C# code is this: public static class POCOExt { public static void Print(this POCO poco) { Console.WriteLine(poco); Console.WriteLine(poco.Created); } } public class POCO { public DateTime Created { get; set; } public POCO() { Created = DateTime.Now; } } I drop that assembly into my DLLs folder, when using it in ipy it doesn't seem to be detecting the extension methods. After doing a dir on POCO, I expected to see the method Print. >>> from DLRInterop import * >>> p = POCO() >>> dir (p) ['Created', 'Equals', 'Finalize', 'GetHashCode', 'GetType', 'MemberwiseClone', 'ReferenceEquals', 'ToString', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'get_Created', 'set_Created'] >>> p.Print() Traceback (most recent call last): File , line unknown, in Initialize##48 AttributeError: 'POCO' object has no attribute 'Print' This appeared to work, but it does go against C# 3.0 and isn't a great approach.... >>> POCOExt.Print(p) DLRInterop.POCO 08/04/2008 22:43:59 Is there anything special I need to do to get this to work as I would expect, or is there something where to call the Extension Method you need to go to the extension class? Cheers Ben Blog.BenHall.me.uk _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From kfarmer at thuban.org Wed Apr 9 04:00:21 2008 From: kfarmer at thuban.org (Keith J. Farmer) Date: Tue, 8 Apr 2008 19:00:21 -0700 Subject: [IronPython] C# Extension Methods and IP B2 References: <7AD436E4270DD54A94238001769C2227011DAFFE3B07@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: FWIW, I experimented around with the DLR's extension method API about a month or so back and got blocked while reflecting (apparent DLR bug). I didn't delve much further, but I don't think it would be too problematic to add it as a brain-dead feature (among all the others ;9) once that was fixed. You'd of course be limited to inspecting for those methods marked with the Extension attribute which (for example) C#3 compiles in. One problem you'd have, though, is that much of the interesting LINQ API revolves around IQueryable and Expression trees, which you would have to build by hand unless they provided a generator for Python (or, generally DLR languages). ________________________________ From: users-bounces at lists.ironpython.com on behalf of Dino Viehland Sent: Tue 4/8/2008 6:34 PM To: Discussion of IronPython Subject: Re: [IronPython] C# Extension Methods and IP B2 We don't yet really support extension methods except for the ones provided by a host using the DLR style extension methods. If you want to use those you need to just add: [assembly: ExtensionType(typeof(POCO), typeof(POCOExt))] And then call RuntimeHelpers.RegisterAssembly and pass in the declaring assembly. We should pick up the types after that. RuntimeHelpers.RegisterAssembly is not final API. It's likely to change in B2 as one of the last bug fixes to multi-runtime support. I don't know that we will support the C# 3.0 style extension attributes in the 2.0 timeframe. While we could presumably support it we'd be required to create every custom attribute on the 1st parameter of every method in an assembly. Therefore it may be more significant of a feature than we'd like to fit in during the betas because we'd have to do something more intelligent than that. Hopefully this work around will suffice - at least for your own extension types. And FYI I'm guessing you're probably using 2.0 B1 not B2 :). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Ben Hall Sent: Tuesday, April 08, 2008 2:53 PM To: Discussion of IronPython Subject: [IronPython] C# Extension Methods and IP B2 Hi everyone, Tonight I was going to write a blog post on C# Interop so I I was playing around a bit more with some of the new C# 3.0 features and I looked at Extension methods and I can't seem to get it to work with IP B2. My C# code is this: public static class POCOExt { public static void Print(this POCO poco) { Console.WriteLine(poco); Console.WriteLine(poco.Created); } } public class POCO { public DateTime Created { get; set; } public POCO() { Created = DateTime.Now; } } I drop that assembly into my DLLs folder, when using it in ipy it doesn't seem to be detecting the extension methods. After doing a dir on POCO, I expected to see the method Print. >>> from DLRInterop import * >>> p = POCO() >>> dir (p) ['Created', 'Equals', 'Finalize', 'GetHashCode', 'GetType', 'MemberwiseClone', 'ReferenceEquals', 'ToString', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', 'get_Created', 'set_Created'] >>> p.Print() Traceback (most recent call last): File , line unknown, in Initialize##48 AttributeError: 'POCO' object has no attribute 'Print' This appeared to work, but it does go against C# 3.0 and isn't a great approach.... >>> POCOExt.Print(p) DLRInterop.POCO 08/04/2008 22:43:59 Is there anything special I need to do to get this to work as I would expect, or is there something where to call the Extension Method you need to go to the extension class? Cheers Ben Blog.BenHall.me.uk _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From daftspaniel at gmail.com Wed Apr 9 22:31:21 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Wed, 9 Apr 2008 21:31:21 +0100 Subject: [IronPython] Late Binding in IronPython Message-ID: <20253b0c0804091331h36950b5o4244d7134ca83c22@mail.gmail.com> Hi List, It seems odd posting here with my work hat on but here goes... :-) !! I've been looking at using IronPython and COM to work with some COM objects with VB6 (Project Compatibility - a *TOTAL* nightmare for interop). In VB.net we get round this with CreateObject which works well though somewhat limit. Is ?X:PreferComDispatch flag intended to be an equivalent for IronPython and any other DLR languages? VBX? Thanks, Davy Mitchell -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From angrygreg at gmail.com Thu Apr 10 03:51:43 2008 From: angrygreg at gmail.com (Greg Akins) Date: Wed, 9 Apr 2008 21:51:43 -0400 Subject: [IronPython] Using ipy to "control" a form Message-ID: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> I'm new to IronPython, so please forgive what may be a stupid question As I initially investigate IronPython, I assumed it would be possible to control a form from ipy So I try something like form = Form1() form.Show() <- results in an error related to accessing an object after it's been destroyed or form = Form1() Application.Run(form) Which results in the commandline waiting for Application.Run to return. Is what I'm trying possible? Can anyone to point me towards any examples? -- Greg Akins Software Development Manager SSI Services http://kc.vanadium.com http://www.pghcodingdojo.org http://www.insomnia-consulting.org/monologue From curt at hagenlocher.org Thu Apr 10 03:54:28 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 9 Apr 2008 18:54:28 -0700 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> Message-ID: Use ipyw.exe with Application.Run(). On Wed, Apr 9, 2008 at 6:51 PM, Greg Akins wrote: > I'm new to IronPython, so please forgive what may be a stupid question > > As I initially investigate IronPython, I assumed it would be possible > to control a form from ipy > > So I try something like > > form = Form1() > form.Show() <- results in an error related to accessing an object > after it's been destroyed > > or > > form = Form1() > Application.Run(form) > > Which results in the commandline waiting for Application.Run to return. > > Is what I'm trying possible? Can anyone to point me towards any examples? > > -- > Greg Akins > Software Development Manager > SSI Services > > http://kc.vanadium.com > http://www.pghcodingdojo.org > http://www.insomnia-consulting.org/monologue > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sanxiyn at gmail.com Thu Apr 10 04:04:57 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Thu, 10 Apr 2008 11:04:57 +0900 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> Message-ID: <5b0248170804091904q193b4ea1p7a20a0c44daf84b9@mail.gmail.com> 2008/4/10, Greg Akins : > As I initially investigate IronPython, I assumed it would be possible > to control a form from ipy If what you are trying to do is to play with WinForms from the interactive console, then you may want to study Tutorial/winforms.py carefully. (Or just use it.) -- Seo Sanghyeon From curt at hagenlocher.org Thu Apr 10 04:15:07 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 9 Apr 2008 19:15:07 -0700 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: <5b0248170804091904q193b4ea1p7a20a0c44daf84b9@mail.gmail.com> References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> <5b0248170804091904q193b4ea1p7a20a0c44daf84b9@mail.gmail.com> Message-ID: On Wed, Apr 9, 2008 at 7:04 PM, Sanghyeon Seo wrote: > 2008/4/10, Greg Akins : > >> As I initially investigate IronPython, I assumed it would be possible >> to control a form from ipy > > If what you are trying to do is to play with WinForms from the > interactive console, then you may want to study Tutorial/winforms.py > carefully. (Or just use it.) I think winforms.py isn't working in IronPython 2.0 beta 1, but this is a good idea for 1.x. -- Curt Hagenlocher curt at hagenlocher.org From ctrachte at gmail.com Thu Apr 10 06:56:33 2008 From: ctrachte at gmail.com (Carl Trachte) Date: Wed, 9 Apr 2008 21:56:33 -0700 Subject: [IronPython] NUnit Recipe - IronPython Cookbook - testing/Visual Studio newb Message-ID: <426ada670804092156w6fea847cy4c2c00959adb552f@mail.gmail.com> Hello. I'm trying to get started testing. I am looking at this NUnit recipe (from the IronPython cookbook): http://blog.bittercoder.com/PermaLink,guid,86b0df08-9bb5-4d3b-a365-fdc7b5d57942.aspx I have downloaded the source code, but I'm stuck on the build. This may be off-topic, but I haven't used Visual Studio regularly since VB6. It is probably my ignorance of the IDE tool along with my ignorance of testing that is causing the problem. My setup: Windows XP NUnit 2.4.7 IronPython-1.1.1 Visual Studio Express 2008 for C# When I hit F6 to build I get a bunch of reference errors. The IronPython and IronMath ones I've corrected, but there are still about 11 more reference and namespace related problems (I admit that I don't know how to print them out). Can anyone point me in the right direction, even if it's just where to start with the IDE? I know from posts on this newsgroup that there is a unittest module in IronPython 2 beta. I'm just reluctant to jump in on a beta version when I'm working with production code. Correct me if this assumption is wrong. Thanks a ton for your help. Carl T. From angrygreg at gmail.com Thu Apr 10 13:21:44 2008 From: angrygreg at gmail.com (Greg Akins) Date: Thu, 10 Apr 2008 07:21:44 -0400 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> <5b0248170804091904q193b4ea1p7a20a0c44daf84b9@mail.gmail.com> Message-ID: <8526685f0804100421u2cdd7e05h8fecdb49bc4038b5@mail.gmail.com> On Wed, Apr 9, 2008 at 10:15 PM, Curt Hagenlocher wrote: > On Wed, Apr 9, 2008 at 7:04 PM, Sanghyeon Seo wrote: > > 2008/4/10, Greg Akins : > > > >> As I initially investigate IronPython, I assumed it would be possible > >> to control a form from ipy > > > > If what you are trying to do is to play with WinForms from the > > interactive console, then you may want to study Tutorial/winforms.py > > carefully. (Or just use it.) > > I think winforms.py isn't working in IronPython 2.0 beta 1, but this > is a good idea for 1.x. Thanks, both of you, for the suggestion. I'll start looking through that Tutorial -- Greg Akins Software Development Manager SSI Services http://kc.vanadium.com http://www.pghcodingdojo.org http://www.insomnia-consulting.org/monologue From angrygreg at gmail.com Thu Apr 10 13:32:32 2008 From: angrygreg at gmail.com (Greg Akins) Date: Thu, 10 Apr 2008 07:32:32 -0400 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> Message-ID: <8526685f0804100432gb110696g738aa2b584aa125@mail.gmail.com> On Wed, Apr 9, 2008 at 9:54 PM, Curt Hagenlocher wrote: > Use ipyw.exe with Application.Run(). > ipyw.exe didn't seem to work? C:\Libraries\IronPython-2.0A6\Tutorial>..\Bin\Debug\ipyw.exe C:\Libraries\IronPython-2.0A6\Tutorial> Nothing appeared when I ran ipyw. No errors. No output. -- Greg Akins Software Development Manager SSI Services http://kc.vanadium.com http://www.pghcodingdojo.org http://www.insomnia-consulting.org/monologue From angrygreg at gmail.com Thu Apr 10 13:37:48 2008 From: angrygreg at gmail.com (Greg Akins) Date: Thu, 10 Apr 2008 07:37:48 -0400 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: <8526685f0804100421u2cdd7e05h8fecdb49bc4038b5@mail.gmail.com> References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> <5b0248170804091904q193b4ea1p7a20a0c44daf84b9@mail.gmail.com> <8526685f0804100421u2cdd7e05h8fecdb49bc4038b5@mail.gmail.com> Message-ID: <8526685f0804100437y1f2792a6n554ff92a030b9564@mail.gmail.com> On Thu, Apr 10, 2008 at 7:21 AM, Greg Akins wrote: > On Wed, Apr 9, 2008 at 10:15 PM, Curt Hagenlocher wrote: > > On Wed, Apr 9, 2008 at 7:04 PM, Sanghyeon Seo wrote: > > > If what you are trying to do is to play with WinForms from the > > > interactive console, then you may want to study Tutorial/winforms.py > > > carefully. (Or just use it.) > > > > I think winforms.py isn't working in IronPython 2.0 beta 1, but this > > is a good idea for 1.x. The tutorial didn't "work" correctly, but winforms.py seemed to work OK. Though I just did a simple form.Show() after executing, it so I'm not sure that it is working completely. The portion of the Tutorial that didn't work for me is listed below. However, I when I executed 'from System.Windows.Forms import Form' (instead of *) then form.Show() worked OK. >>> from System.Windows.Forms import * >>> form = Form() >>> from System.Windows.Forms import * >>> from System.Drawing import * >>> f = Form() Traceback (most recent call last): File , line 0, in ##117 NameError: name 'Form' is not defined -- Greg Akins Software Development Manager SSI Services http://kc.vanadium.com http://www.pghcodingdojo.org http://www.insomnia-consulting.org/monologue From curt at hagenlocher.org Thu Apr 10 13:38:39 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 10 Apr 2008 04:38:39 -0700 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: <8526685f0804100432gb110696g738aa2b584aa125@mail.gmail.com> References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> <8526685f0804100432gb110696g738aa2b584aa125@mail.gmail.com> Message-ID: On Thu, Apr 10, 2008 at 4:32 AM, Greg Akins wrote: > On Wed, Apr 9, 2008 at 9:54 PM, Curt Hagenlocher wrote: > > Use ipyw.exe with Application.Run(). > > Nothing appeared when I ran ipyw. No errors. No output. ipyw.exe doesn't give you an interactive console; you need to use it with a script. It's basically a way of running a Python script without a console. -- Curt Hagenlocher curt at hagenlocher.org From angrygreg at gmail.com Thu Apr 10 13:41:26 2008 From: angrygreg at gmail.com (Greg Akins) Date: Thu, 10 Apr 2008 07:41:26 -0400 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> <8526685f0804100432gb110696g738aa2b584aa125@mail.gmail.com> Message-ID: <8526685f0804100441s428c72dbh8def9ced30a6cd8d@mail.gmail.com> On Thu, Apr 10, 2008 at 7:38 AM, Curt Hagenlocher wrote: > > ipyw.exe doesn't give you an interactive console; you need to use it > with a script. It's basically a way of running a Python script > without a console. > Thanks Curt. And sorry for not reading farther to self-answer what was probably obvious. I'm trying to get little slices of time to work on this, so I'm firing off these question a little too quickly. -- Greg Akins Software Development Manager SSI Services http://kc.vanadium.com http://www.pghcodingdojo.org http://www.insomnia-consulting.org/monologue From curt at hagenlocher.org Thu Apr 10 13:49:38 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 10 Apr 2008 04:49:38 -0700 Subject: [IronPython] Using ipy to "control" a form In-Reply-To: <8526685f0804100437y1f2792a6n554ff92a030b9564@mail.gmail.com> References: <8526685f0804091851t4f3d4ab9x69ede4f7afe9d530@mail.gmail.com> <5b0248170804091904q193b4ea1p7a20a0c44daf84b9@mail.gmail.com> <8526685f0804100421u2cdd7e05h8fecdb49bc4038b5@mail.gmail.com> <8526685f0804100437y1f2792a6n554ff92a030b9564@mail.gmail.com> Message-ID: On Thu, Apr 10, 2008 at 4:37 AM, Greg Akins wrote: > > However, I when I executed 'from System.Windows.Forms import Form' > (instead of *) then form.Show() worked OK. This may have been a problem with 2.0A6; it seems to work just fine in 2.0B1. Though I'd suggest that importing * from System.Windows.Forms is not necessarily the best approach (at least in production code), especially given that it's got over 700 items in its namespace. Even when just playing interactively, you risk silently overwriting previously-defined symbols when you "import *". -- Curt Hagenlocher curt at hagenlocher.org From ben2004uk at googlemail.com Thu Apr 10 14:59:32 2008 From: ben2004uk at googlemail.com (Ben Hall) Date: Thu, 10 Apr 2008 13:59:32 +0100 Subject: [IronPython] NUnit Recipe - IronPython Cookbook - testing/Visual Studio newb In-Reply-To: <426ada670804092156w6fea847cy4c2c00959adb552f@mail.gmail.com> References: <426ada670804092156w6fea847cy4c2c00959adb552f@mail.gmail.com> Message-ID: Hi, Have you updated your NUnit references? In the Solution Explorer, you can see a references item. Under this are all the references to other assemblies. If any of these have a yellow warning icon, then thats your problem. Hope this helps. Ben Blog.BenHall.me.uk On Thu, Apr 10, 2008 at 5:56 AM, Carl Trachte wrote: > Hello. > > I'm trying to get started testing. I am looking at this NUnit recipe > (from the IronPython cookbook): > > http://blog.bittercoder.com/PermaLink,guid,86b0df08-9bb5-4d3b-a365-fdc7b5d57942.aspx > > I have downloaded the source code, but I'm stuck on the build. This > may be off-topic, but I haven't used Visual Studio regularly since > VB6. It is probably my ignorance of the IDE tool along with my > ignorance of testing that is causing the problem. > > My setup: > Windows XP > NUnit 2.4.7 > IronPython-1.1.1 > Visual Studio Express 2008 for C# > > When I hit F6 to build I get a bunch of reference errors. The > IronPython and IronMath ones I've corrected, but there are still about > 11 more reference and namespace related problems (I admit that I don't > know how to print them out). > > Can anyone point me in the right direction, even if it's just where to > start with the IDE? > > I know from posts on this newsgroup that there is a unittest module in > IronPython 2 beta. I'm just reluctant to jump in on a beta version > when I'm working with production code. > > Correct me if this assumption is wrong. > > Thanks a ton for your help. > > Carl T. > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From ronnie.maor at gmail.com Thu Apr 10 21:40:41 2008 From: ronnie.maor at gmail.com (Ronnie Maor) Date: Thu, 10 Apr 2008 22:40:41 +0300 Subject: [IronPython] FW: IronPython Studio 1.0 for Isolated and Integrated VS Shell In-Reply-To: <2fd6b9d0804060137teebea7ei9ec4446a5f3457bc@mail.gmail.com> References: <2fd6b9d0804050235j6cdf0218y60cff76245818258@mail.gmail.com> <2fd6b9d0804060134s1930a390n22fded21c2f48d5a@mail.gmail.com> <2fd6b9d0804060137teebea7ei9ec4446a5f3457bc@mail.gmail.com> Message-ID: <2fd6b9d0804101240oc873c62sadd0e8f0cc95b0f2@mail.gmail.com> finally had some time to play with it. To convert projects from VS SDK sample to IronPython Studio, you need to edit the pyproj files and replace the line near the end of the project that reads with On Sun, Apr 6, 2008 at 11:37 AM, Ronnie Maor wrote: > forgot to mention that I'm using IPy 1.1.1 > > > On Sun, Apr 6, 2008 at 11:34 AM, Ronnie Maor > wrote: > > > two answers and some more info :-) > > > > 1) This is the first version IPy Studio version I've tried. I have > > VS2008 Pro, and have been working with the VS SDK sample in the experimental > > hive. The problem with the experimental hive is that we also have ReSharper > > and we couldn't get ReSharper to work in the hive or python support > > installed outside the hive, so we now have two IDEs. > > So when I saw your post on IPy Studio integrated mode, I decided to try > > it as a way to ditch the experimental hive. > > I installed using the binary integrated mode setup file (using all > > defaults), and then just tried to load my current solution and got the error > > message. > > > > I assumed that since IPy Studio was based on the sample it could just > > run my current solution with projects created with the sample in the > > experimental hive. Right now I'm guessing this is where I was wrong. > > > > 2) My python projects are class libraries, not web apps. The solution > > contains other projects which are C# libraries and a web app (ASP.NET in > > C#), but as far as I understand that shouldn't affect IPy Studio's ability > > to load my python project (?) > > > > I just tried creating a new solution with VS2008 + IPy Studio and > > creating python class libraries in it. This seems to work. > > Copying the files from my previous project and re-adding them to a new > > project also worked (although I didn't import all the files/directories yet) > > Copying the files + the project and trying to add the existing project > > failed again in the new solution with the same error. > > > > So now I have one configuration that seems to work and another that > > doesn't. I'll try building it the way that works and comparing the project > > files and hopefully will find what the difference is, and how to solve it, > > and post that here. > > > > However, if someone knows what the answer is already - please let me > > know :-) > > > > thanks > > Ronnie > > > > > > On Sun, Apr 6, 2008 at 12:12 AM, Harry Pierson < > > Harry.Pierson at microsoft.com> wrote: > > > > > Two questions: > > > > > > > > > > > > 1. Did it work before with the previous IPy Studio? > > > > > > 2. Is it a web app? The URL you included related to web apps, > > > and AFAIK IPy Studio doesn't include web app development support. > > > > > > > > > > > > Harry > > > > > > > > > > > > *From:* users-bounces at lists.ironpython.com [mailto: > > > users-bounces at lists.ironpython.com] *On Behalf Of *Ronnie Maor > > > *Sent:* Saturday, April 05, 2008 2:35 AM > > > *To:* Discussion of IronPython > > > *Subject:* Re: [IronPython] FW: IronPython Studio 1.0 for Isolated and > > > Integrated VS Shell > > > > > > > > > > > > this sounds great - integration with VS2008 will be much better than > > > running with the experimental hive. > > > > > > however, after installing, my python projects failed to load, with the > > > following error: > > > "could not find any resources appropriate for the specified culture or > > > neutral culture..." (see attached screenshot). > > > > > > also found this blog entry which sounds relevent: > > > http://weblogs.asp.net/ngur/archive/2003/12/28/46219.aspx > > > > > > hoping this post will make it to someone who can fix the problem, or > > > let me know how to work around it... > > > > > > thanks > > > Ronnie > > > > > > On Tue, Apr 1, 2008 at 2:36 AM, Harry Pierson < > > > Harry.Pierson at microsoft.com> wrote: > > > > > > Ken Levy from the Visual Studio extensibility team just blogged about > > > the 1.0 new release of IronPython Studio ( > > > http://codeplex.com/IronPythonStudio). As is pointed out below, this > > > new version supports the integrated VS08 Shell, which means that if you > > > already have VS08 installed, IPy Studio will just snap right into it. If you > > > don't have VS08, you can download the VS08 shell for free (directions on the > > > site) > > > > > > > > > > > > Harry Pierson > > > > > > PM, IronPython > > > > > > harry.pierson at microsoft.com > > > > > > http://devhawk.net > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://blogs.msdn.com/vsxteam/archive/2008/03/31/ironpython-studio-1-0-for-isolated-and-integrated-vs-shell.aspx > > > > > > > > > > > > IronPython is now available in for both integrated and isolated VS > > > Shell, see blog post for details. > > > > > > > > > > > > > > > _______________________________________________ > > > Users mailing list > > > Users at lists.ironpython.com > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > > > > _______________________________________________ > > > Users mailing list > > > Users at lists.ironpython.com > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Fri Apr 11 00:16:15 2008 From: Shri.Borde at microsoft.com (Shri Borde) Date: Thu, 10 Apr 2008 15:16:15 -0700 Subject: [IronPython] COM Late Binding in IronPython In-Reply-To: <20253b0c0804091331h36950b5o4244d7134ca83c22@mail.gmail.com> References: <20253b0c0804091331h36950b5o4244d7134ca83c22@mail.gmail.com> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8EDA7ADDC9F1@DF-GRTDANE-MSG.exchange.corp.microsoft.com> I am not sure what the exact question is. However, I have posted the following at http://blogs.msdn.com/shrib/archive/2008/04/10/ole-automation-idispatch-support-in-ironpython.aspx to help understand what -X:PreferComDispatch does. OLE automation (IDispatch) support in IronPython IronPython 1.X supported COM interop by building on top of the COM interop support built into the CLR. This relies on the use of interop assemblies for managed code to access COM objects. The interop assembly can be accessed in different ways: 1. clr.AddReference("interopAssembly") - This is the preferred mechanism so that the interop assembly does not have to be created multiple times. The down-side is that it complicates deployment. You have to ensure that the interop assembly exists on the machine. 2. Having IronPython automatically generate it on the fly - if you have a OLE automation object, IronPython tries to find its type library (TLB) and then to convert the TLB to an interop assembly on the fly using the TypeLibConverter class. The advantage is that this works seamlessly as long as there is a type library on the machine. The down-side is that this conversion can take a long time for large TLB files. This is how Word could be accessed. It requires the interop assembly Microsoft.Office.Interop.Word.dll to be available on the machine. c:\>ipy.exe IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433 Copyright (c) Microsoft Corporation. All rights reserved. >>> import clr >>> clr.AddReference("Microsoft.Office.Interop.Word") >>> from Microsoft.Office.Interop.Word import ApplicationClass >>> word = ApplicationClass() >>> word.Visible = True >>> doc = word.Documents.Add() >>> doc.Range().Text = "Hello from IronPython" >>> word.Quit() >>> IronPython 2.0 has added support for interacting with OLE automation objects using the IDispatch interface. This completely eliminates the need for interop assemblies. This is the same mechanism that VBA late-bound code and also WSH use to interact with OLE automation object. This feature can currently be accessed using the -X:PreferComDispatch command line option. Here is an interactive session showing access to Word. There are no interop assemblies in the picture. c:\>ipyd -X:PreferComDispatch IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433 Copyright (c) Microsoft Corporation. All rights reserved. >>> import clr >>> import System >>> wordTypeLibGuid = System.Guid("00020905-0000-0000-C000-000000000046") >>> clr.AddReferenceToTypeLibrary(wordTypeLibGuid) >>> from Word import Application >>> word = Application() >>> word.Visible = True >>> doc = word.Documents.Add() >>> doc.Range().Text = "Hello from IronPython" >>> word.Quit() >>> The feature is not complete yet, and so is not currently (April 08) enabled by default. I cant say for sure when we will enable it by default, but its already quite stable for many real-world uses. We run all of our COM tests in both modes - using interop assemblies and using IDispatch. There are a few differences between the two cases in the minute details, but the mainline scenarios work well in both. This feature is implemented in the DLR, and so should be accessible from all DLR-based languages with little effort. Thanks, Shri Want to work on IronPython, IronRuby, F#? Visit http://blogs.msdn.com/ironpython From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell Sent: Wednesday, April 09, 2008 1:31 PM To: Discussion of IronPython Subject: [IronPython] Late Binding in IronPython Hi List, It seems odd posting here with my work hat on but here goes... :-) !! I've been looking at using IronPython and COM to work with some COM objects with VB6 (Project Compatibility - a *TOTAL* nightmare for interop). In VB.net we get round this with CreateObject which works well though somewhat limit. Is -X:PreferComDispatch flag intended to be an equivalent for IronPython and any other DLR languages? VBX? Thanks, Davy Mitchell -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.gif Type: image/gif Size: 480 bytes Desc: image001.gif URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.gif Type: image/gif Size: 466 bytes Desc: image002.gif URL: From daftspaniel at gmail.com Fri Apr 11 15:09:34 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Fri, 11 Apr 2008 14:09:34 +0100 Subject: [IronPython] COM Late Binding in IronPython In-Reply-To: <50B69702CA6E6D4E849D30CD4989AB8EDA7ADDC9F1@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <20253b0c0804091331h36950b5o4244d7134ca83c22@mail.gmail.com> <50B69702CA6E6D4E849D30CD4989AB8EDA7ADDC9F1@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <20253b0c0804110609g2f4c2e74k6bcb0e299a868cb4@mail.gmail.com> Thanks very much Shri - this is a really good explanation. Particulary happy about wider DLR support as easier to sell the dynamic approach if other languages a possibility. I could see members of my team being cautious about using a 'off by default' feature in a beta of a strange language (to some!). A feature 'Coming soon' for the entire DLR is much more appealing though we would probably start with IronPython. Regards, Davy Mitchell On Thu, Apr 10, 2008 at 11:16 PM, Shri Borde wrote: > I am not sure what the exact question is. However, I have posted the > following at > http://blogs.msdn.com/shrib/archive/2008/04/10/ole-automation-idispatch-support-in-ironpython.aspxto help understand what ?X:PreferComDispatch does. > > > > *OLE automation (IDispatch) support in IronPython **[image: > http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-left-off.gif][image: > http://blogs.msdn.com/Themes/default/images/common/star-right-off.gif]*** > > IronPython 1.X supported COM interop by building on top of the COM interopsupport built into the CLR. This relies on the use of interop assemblies for > managed code to access COM objects. The interop assembly can be accessed in > different ways: > > 1. clr.AddReference("interopAssembly") - This is the preferred > mechanism so that the interop assembly does not have to be created multiple > times. The down-side is that it complicates deployment. You have to ensurethat the interop assembly exists on the machine. > > 2. Having IronPython automatically generate it on the fly - if you > have a OLE automation object, IronPython tries to find its type library > (TLB) and then to convert the TLB to an interop assembly on the fly using > the TypeLibConverterclass. The advantage is that this works seamlessly as long as there is a > type library on the machine. The down-side is that this conversion can take > a long time for large TLB files. > > This is how Word could be accessed. It requires the interop assembly > Microsoft.Office.Interop.Word.dll to be available on the machine. > > c:\>ipy.exe > IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433 > Copyright (c) Microsoft Corporation. All rights reserved. > >>> import clr > >>> clr.AddReference("Microsoft.Office.Interop.Word") > >>> from Microsoft.Office.Interop.Word import ApplicationClass > >>> word = ApplicationClass() > >>> word.Visible = True > >>> doc = word.Documents.Add() > >>> doc.Range().Text = "Hello from IronPython" > >>> word.Quit() > >>> > > IronPython 2.0 has added support for interacting with OLE automation > objects using the IDispatch interface. This completely eliminates the need > for interop assemblies. This is the same mechanism that VBAlate-bound code and also > WSH use to > interact with OLE automation object. This feature can currently be accessed > using the -X:PreferComDispatch command line option. Here is an interactive > session showing access to Word. There are no interop assemblies in the > picture. > > c:\>ipyd -X:PreferComDispatch > IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433 > Copyright (c) Microsoft Corporation. All rights reserved. > >>> import clr > >>> import System > >>> wordTypeLibGuid = System.Guid("00020905-0000-0000-C000-000000000046") > >>> clr.AddReferenceToTypeLibrary(wordTypeLibGuid) > >>> from Word import Application > >>> word = Application() > >>> word.Visible = True > >>> doc = word.Documents.Add() > >>> doc.Range().Text = "Hello from IronPython" > >>> word.Quit() > >>> > > The feature is not complete yet, and so is not currently (April 08) > enabled by default. I cant say for sure when we will enable it by default, > but its already quite stable for many real-world uses. We run all of our COM > tests in both modes - using interop assemblies and using IDispatch. There > are a few differences between the two cases in the minute details, but the > mainline scenarios work well in both. This feature is implemented in the > DLR, and so should be accessible from all DLR-based languages with little > effort. > > > > Thanks, > > Shri > > Want to work on IronPython, IronRuby, F#? Visit > http://blogs.msdn.com/ironpython > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Davy Mitchell > *Sent:* Wednesday, April 09, 2008 1:31 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] Late Binding in IronPython > > > > Hi List, > > It seems odd posting here with my work hat on but here goes... :-) !! > > I've been looking at using IronPython and COM to work with some COM > objects with VB6 (Project Compatibility - a *TOTAL* nightmare for interop). > In VB.net we get round this with CreateObject which works well though > somewhat limit. > > Is ?X:PreferComDispatch flag intended to be an equivalent for IronPython > and any other DLR languages? VBX? > > Thanks, > Davy Mitchell > > -- > Davy Mitchell > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > Twitter - http://twitter.com/daftspaniel > Skype - daftspaniel http://needgod.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ctrachte at gmail.com Sat Apr 12 23:39:17 2008 From: ctrachte at gmail.com (Carl Trachte) Date: Sat, 12 Apr 2008 14:39:17 -0700 Subject: [IronPython] NUnit Recipe - IronPython Cookbook - testing/Visual Studio newb In-Reply-To: References: <426ada670804092156w6fea847cy4c2c00959adb552f@mail.gmail.com> Message-ID: <426ada670804121439j2e875475q12694e460d8d9566@mail.gmail.com> On 4/10/08, Ben Hall wrote: > Have you updated your NUnit references? In the Solution Explorer, you > can see a references item. Under this are all the references to other > assemblies. If any of these have a yellow warning icon, then thats > your problem. > > Hope this helps. > > Ben > Blog.BenHall.me.uk Ben, Thanks for the help. I'm closer now than I was before. There are still four errors: Three for unrecognized (presumably NUnit) functions - IsFixture, DoFixtureSetUp, and DoFixtureTearDown, and one because the dll does not get built. The complete text is shown below. I'm thinking that I may be using the wrong version of NUnit for bittercoder's source code (I'm using the current one 2.4.7) or maybe I'm just completely lost again. I've grepped (in Cygwin) the 2.4.7 source and I can't find any references to these functions. Any help would be greatly appreciated. Error text from Visual Studio Express 2008: Error 1 'IronPythonLib.NUnit.PythonFixtureExtension.IsFixture': no suitable method found to override D:\IronPythonStuff\IronPythonLib\NUnit\PythonFixtureExtension.cs 28 30 IronPythonLib Error 2 'IronPythonLib.NUnit.PythonFixtureExtension.DoFixtureSetUp(NUnit.Core.TestResult)': no suitable method found to override D:\IronPythonStuff\IronPythonLib\NUnit\PythonFixtureExtension.cs 33 30 IronPythonLib Error 3 'IronPythonLib.NUnit.PythonFixtureExtension.DoFixtureTearDown(NUnit.Core.TestResult)': no suitable method found to override D:\IronPythonStuff\IronPythonLib\NUnit\PythonFixtureExtension.cs 66 30 IronPythonLib Error 4 Metadata file 'D:\IronPythonStuff\IronPythonLib\bin\Release\IronPythonLib.dll' could not be found IronPythonLib.Tests From ben2004uk at googlemail.com Sun Apr 13 00:59:01 2008 From: ben2004uk at googlemail.com (Ben Hall) Date: Sat, 12 Apr 2008 23:59:01 +0100 Subject: [IronPython] NUnit Recipe - IronPython Cookbook - testing/Visual Studio newb In-Reply-To: <426ada670804121439j2e875475q12694e460d8d9566@mail.gmail.com> References: <426ada670804092156w6fea847cy4c2c00959adb552f@mail.gmail.com> <426ada670804121439j2e875475q12694e460d8d9566@mail.gmail.com> Message-ID: I'm guessing this is because of changes between NUnit 2.2 and 2.4. I suggest you give an older version of NUnit a try they are all listed here: http://www.nunit.org/index.php?p=download If you have more trouble I'm happy to have a closer look at the code :) On Sat, Apr 12, 2008 at 10:39 PM, Carl Trachte wrote: > On 4/10/08, Ben Hall wrote: > > > Have you updated your NUnit references? In the Solution Explorer, you > > can see a references item. Under this are all the references to other > > assemblies. If any of these have a yellow warning icon, then thats > > your problem. > > > > Hope this helps. > > > > Ben > > Blog.BenHall.me.uk > > Ben, > > Thanks for the help. I'm closer now than I was before. There are > still four errors: > > Three for unrecognized (presumably NUnit) functions - IsFixture, > DoFixtureSetUp, and DoFixtureTearDown, and one because the dll does > not get built. The complete text is shown below. > > I'm thinking that I may be using the wrong version of NUnit for > bittercoder's source code (I'm using the current one 2.4.7) or maybe > I'm just completely lost again. I've grepped (in Cygwin) the 2.4.7 > source and I can't find any references to these functions. > > Any help would be greatly appreciated. > > Error text from Visual Studio Express 2008: > > Error 1 'IronPythonLib.NUnit.PythonFixtureExtension.IsFixture': no > suitable method found to > override D:\IronPythonStuff\IronPythonLib\NUnit\PythonFixtureExtension.cs 28 30 IronPythonLib > > > Error 2 'IronPythonLib.NUnit.PythonFixtureExtension.DoFixtureSetUp(NUnit.Core.TestResult)': > no suitable method found to > override D:\IronPythonStuff\IronPythonLib\NUnit\PythonFixtureExtension.cs 33 30 IronPythonLib > > > Error 3 'IronPythonLib.NUnit.PythonFixtureExtension.DoFixtureTearDown(NUnit.Core.TestResult)': > no suitable method found to > override D:\IronPythonStuff\IronPythonLib\NUnit\PythonFixtureExtension.cs 66 30 IronPythonLib > > Error 4 Metadata file > 'D:\IronPythonStuff\IronPythonLib\bin\Release\IronPythonLib.dll' could > not be found IronPythonLib.Tests > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From ctrachte at gmail.com Sun Apr 13 03:03:11 2008 From: ctrachte at gmail.com (Carl Trachte) Date: Sat, 12 Apr 2008 18:03:11 -0700 Subject: [IronPython] NUnit Recipe - IronPython Cookbook - testing/Visual Studio newb In-Reply-To: References: <426ada670804092156w6fea847cy4c2c00959adb552f@mail.gmail.com> <426ada670804121439j2e875475q12694e460d8d9566@mail.gmail.com> Message-ID: <426ada670804121803t52b0ac9ao579f2b94ec21a24@mail.gmail.com> On 4/12/08, Ben Hall wrote: > I'm guessing this is because of changes between NUnit 2.2 and 2.4. I > suggest you give an older version of NUnit a try > > they are all listed here: > http://www.nunit.org/index.php?p=download Ben, I downloaded the 2.2.10 NUnit code, grepped for the missing functions and Bingo! - there they were. I haven't set up 2.2.10 yet, but I suspect this will work. Ultimately, I'd like to adapt the recipe to the current version of NUnit, but I've got to walk before I can run. I will also attempt to contact Bitter Coder concerning the article (noting that it uses NUnit 2.2 and that NUnit 2.4 breaks the code). > > If you have more trouble I'm happy to have a closer look at the code :) That's really decent of you. You've been eminently generous with a newb already. From curt at hagenlocher.org Sun Apr 13 05:21:12 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sat, 12 Apr 2008 20:21:12 -0700 Subject: [IronPython] Writing PowerShell cmdlets in Python Message-ID: http://hagenlocher.org/software/PythonCmdlet.zip This is a sample project that shows one approach to creating a PowerShell cmdlet using IronPython. The cmdlet object has to derive from System.Management.Automation.Cmdlet, it needs to override particular virtual functions and it needs appropriate attributes on the class and on the properties representing the cmdlet's parameters. Originally, I was hoping to use the project I'm working on[1] to automatically generate an appropriate wrapper from the Python class. Unfortunately, I haven't yet been able to think of a sufficiently clever scheme to handle the scenario where the wrapper needs to be derived from a specific base class, and the Python object can transparently access the members of that same base class despite not having the same object identity. Here, I've taken the approach of passing the actual Cmdlet-derived class as a parameter to the constructor of the Python class. The Python script itself is stored as a resource in the cmdlet. The cmdlet implements a "browse-matches" command that is designed to have MatchInfo objects pipelined into it. Usage would be something like this: select-string NewTypeMaker | browse-matches The results are displayed as simple strings in a listbox on a modal form. Information on installing and using a PowerShell cmdlet can be found (among other places) at http://blog.cumps.be/using-powershell-writing-and-debugging-cmdlets/ This project is based on IronPython 2.0B1. 1: http://www.codeplex.com/coils -- not forgotten, but currently held up by an unresolved "strongly-named assembly is required" that I'm trying to work around. -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From daftspaniel at gmail.com Sun Apr 13 08:53:26 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Sun, 13 Apr 2008 07:53:26 +0100 Subject: [IronPython] PreferComDispatch - Odd Behaviour Message-ID: <20253b0c0804122353y9992caame3ee9e993ff5a6f1@mail.gmail.com> IP2.0.0.1000 from System import Type, Activator wb = Activator.CreateInstance(Type.GetTypeFromProgID("WScript.Shell")) print dir(wb) print wb.CurrentDirectory() print wb.SpecialFolders("Desktop") print dir(wb) The first dir of wb is missing a method which appears as soon as a call is made to it. Interestingly CurrentDirectory is listed in the first dir without being called. ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', 'GetAttrNames ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', 'Initialize LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'ToString', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__' , '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] c:\code\comtry c:\users\daftspaniel\desktop ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', 'GetAttrNames ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', 'Initialize LifetimeService', 'MemberwiseClone', 'ReferenceEquals', '*SpecialFolders*', 'ToStr ing', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__ init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '_ _str__'] Thanks, Davy Mitchell -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Mon Apr 14 21:28:59 2008 From: Shri.Borde at microsoft.com (Shri Borde) Date: Mon, 14 Apr 2008 12:28:59 -0700 Subject: [IronPython] PreferComDispatch - Odd Behaviour In-Reply-To: <20253b0c0804122353y9992caame3ee9e993ff5a6f1@mail.gmail.com> References: <20253b0c0804122353y9992caame3ee9e993ff5a6f1@mail.gmail.com> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8EE48F656230@DF-GRTDANE-MSG.exchange.corp.microsoft.com> We infer that the object implements IWshShell3 which declared the CurrentDirectory property. From the TLB info, we know about CurrentDirectory right away. However, SpecialFolders is declared on the base interface IWhsShell. Looks like we just need to walk up the class hierarchy. We currently don't do this. I have opened http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16107 to track this. SpecialFolders does appear when you use it because we use IDispatch.GetIDsOfNames on it, and it is there ofcourse. Thanks, Shri Want to work on IronPython, IronRuby, F#? Visit http://blogs.msdn.com/ironpython/ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell Sent: Saturday, April 12, 2008 11:53 PM To: Discussion of IronPython Subject: [IronPython] PreferComDispatch - Odd Behaviour IP2.0.0.1000 from System import Type, Activator wb = Activator.CreateInstance(Type.GetTypeFromProgID("WScript.Shell")) print dir(wb) print wb.CurrentDirectory() print wb.SpecialFolders("Desktop") print dir(wb) The first dir of wb is missing a method which appears as soon as a call is made to it. Interestingly CurrentDirectory is listed in the first dir without being called. ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', 'GetAttrNames ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', 'Initialize LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'ToString', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__' , '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] c:\code\comtry c:\users\daftspaniel\desktop ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', 'GetAttrNames ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', 'Initialize LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'SpecialFolders', 'ToStr ing', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__ init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '_ _str__'] Thanks, Davy Mitchell -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Shri.Borde at microsoft.com Mon Apr 14 21:28:59 2008 From: Shri.Borde at microsoft.com (Shri Borde) Date: Mon, 14 Apr 2008 12:28:59 -0700 Subject: [IronPython] PreferComDispatch - Odd Behaviour In-Reply-To: <20253b0c0804122353y9992caame3ee9e993ff5a6f1@mail.gmail.com> References: <20253b0c0804122353y9992caame3ee9e993ff5a6f1@mail.gmail.com> Message-ID: <50B69702CA6E6D4E849D30CD4989AB8EE48F656230@DF-GRTDANE-MSG.exchange.corp.microsoft.com> We infer that the object implements IWshShell3 which declared the CurrentDirectory property. From the TLB info, we know about CurrentDirectory right away. However, SpecialFolders is declared on the base interface IWhsShell. Looks like we just need to walk up the class hierarchy. We currently don't do this. I have opened http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16107 to track this. SpecialFolders does appear when you use it because we use IDispatch.GetIDsOfNames on it, and it is there ofcourse. Thanks, Shri Want to work on IronPython, IronRuby, F#? Visit http://blogs.msdn.com/ironpython/ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Davy Mitchell Sent: Saturday, April 12, 2008 11:53 PM To: Discussion of IronPython Subject: [IronPython] PreferComDispatch - Odd Behaviour IP2.0.0.1000 from System import Type, Activator wb = Activator.CreateInstance(Type.GetTypeFromProgID("WScript.Shell")) print dir(wb) print wb.CurrentDirectory() print wb.SpecialFolders("Desktop") print dir(wb) The first dir of wb is missing a method which appears as soon as a call is made to it. Interestingly CurrentDirectory is listed in the first dir without being called. ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', 'GetAttrNames ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', 'Initialize LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'ToString', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__' , '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] c:\code\comtry c:\users\daftspaniel\desktop ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', 'GetAttrNames ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', 'Initialize LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'SpecialFolders', 'ToStr ing', '__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__ init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '_ _str__'] Thanks, Davy Mitchell -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From daftspaniel at gmail.com Mon Apr 14 21:55:07 2008 From: daftspaniel at gmail.com (Davy Mitchell) Date: Mon, 14 Apr 2008 20:55:07 +0100 Subject: [IronPython] PreferComDispatch - Odd Behaviour In-Reply-To: <50B69702CA6E6D4E849D30CD4989AB8EE48F656230@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <20253b0c0804122353y9992caame3ee9e993ff5a6f1@mail.gmail.com> <50B69702CA6E6D4E849D30CD4989AB8EE48F656230@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <20253b0c0804141255r60558986h852bb45bdeed0ba3@mail.gmail.com> Thanks for the response Shri. Sounds like the default interface should be fine. The 'real' objects I want to introspect are COM dll's intended for ASP so shouldn't hit this issue. Thanks, Davy Mitchell On Mon, Apr 14, 2008 at 8:28 PM, Shri Borde wrote: > We infer that the object implements IWshShell3 which declared the > CurrentDirectory property. From the TLB info, we know about CurrentDirectory > right away. However, SpecialFolders is declared on the base interface > IWhsShell. Looks like we just need to walk up the class hierarchy. We > currently don't do this. I have opened > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16107 to > track this. > > > > SpecialFolders does appear when you use it because we use > IDispatch.GetIDsOfNames on it, and it is there ofcourse. > > > > Thanks, > > Shri > > Want to work on IronPython, IronRuby, F#? > Visit http://blogs.msdn.com/ironpython/ > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Davy Mitchell > *Sent:* Saturday, April 12, 2008 11:53 PM > *To:* Discussion of IronPython > *Subject:* [IronPython] PreferComDispatch - Odd Behaviour > > > > IP2.0.0.1000 > from System import Type, Activator > wb = Activator.CreateInstance(Type.GetTypeFromProgID("WScript.Shell")) > print dir(wb) > print wb.CurrentDirectory() > print wb.SpecialFolders("Desktop") > print dir(wb) > > The first dir of wb is missing a method which appears as soon as a call is > made to it. > Interestingly CurrentDirectory is listed in the first dir without being > called. > > ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', > 'GetAttrNames > ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', > 'Initialize > LifetimeService', 'MemberwiseClone', 'ReferenceEquals', 'ToString', > '__class__', > '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', > '__new__' > , '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] > c:\code\comtry > c:\users\daftspaniel\desktop > ['CreateObjRef', 'CurrentDirectory', 'Equals', 'Exec', 'Finalize', > 'GetAttrNames > ', 'GetHashCode', 'GetLifetimeService', 'GetMemberNames', 'GetType', > 'Initialize > LifetimeService', 'MemberwiseClone', 'ReferenceEquals', '*SpecialFolders*', > 'ToStr > ing', '__class__', '__delattr__', '__doc__', '__getattribute__', > '__hash__', '__ > init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', > '__setattr__', '_ > _str__'] > > Thanks, > Davy Mitchell > > -- > Davy Mitchell > Blog - http://www.latedecember.co.uk/sites/personal/davy/ > Twitter - http://twitter.com/daftspaniel > Skype - daftspaniel http://needgod.com > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- Davy Mitchell Blog - http://www.latedecember.co.uk/sites/personal/davy/ Twitter - http://twitter.com/daftspaniel Skype - daftspaniel http://needgod.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.eloff at gmail.com Tue Apr 15 22:58:22 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 15 Apr 2008 15:58:22 -0500 Subject: [IronPython] Creating .NET events in IronPython Message-ID: <4817b6fc0804151358x74824c36p2b7bc511a9fa39dc@mail.gmail.com> In C# you can create an event: public event EventHandler MouseScroll; And then you can add event handlers normally using +=, but how do you could you create MouseScroll from IronPython? I've been googling this for over an hour with no luck. Thanks, -Dan From curt at hagenlocher.org Tue Apr 15 23:17:17 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 15 Apr 2008 14:17:17 -0700 Subject: [IronPython] Creating .NET events in IronPython In-Reply-To: <4817b6fc0804151358x74824c36p2b7bc511a9fa39dc@mail.gmail.com> References: <4817b6fc0804151358x74824c36p2b7bc511a9fa39dc@mail.gmail.com> Message-ID: On Tue, Apr 15, 2008 at 1:58 PM, Dan Eloff wrote: > In C# you can create an event: > > public event EventHandler MouseScroll; > > And then you can add event handlers normally using +=, but how do you > could you create MouseScroll from IronPython? Have you looked at Tutorial/pyevent.py? If the classes defined therein don't meet your needs, maybe you could provide a specific example for how you intend to use the event. -- Curt Hagenlocher curt at hagenlocher.org From dan.eloff at gmail.com Wed Apr 16 02:54:49 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 15 Apr 2008 19:54:49 -0500 Subject: [IronPython] Creating .NET events in IronPython In-Reply-To: References: <4817b6fc0804151358x74824c36p2b7bc511a9fa39dc@mail.gmail.com> Message-ID: <4817b6fc0804151754o1cba1e19m635207538dec6187@mail.gmail.com> Thanks, Tutorial/pyevent.py was what I've been looking for. -Dan On Tue, Apr 15, 2008 at 4:17 PM, Curt Hagenlocher wrote: > On Tue, Apr 15, 2008 at 1:58 PM, Dan Eloff wrote: > > In C# you can create an event: > > > > public event EventHandler MouseScroll; > > > > And then you can add event handlers normally using +=, but how do you > > could you create MouseScroll from IronPython? > > Have you looked at Tutorial/pyevent.py? > > If the classes defined therein don't meet your needs, maybe you could > provide a specific example for how you intend to use the event. > > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From tkpmep at gmail.com Wed Apr 16 04:32:06 2008 From: tkpmep at gmail.com (Thomas Philips) Date: Tue, 15 Apr 2008 19:32:06 -0700 (PDT) Subject: [IronPython] Learning IronPython Message-ID: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> I program in Python, but my programs are typically run from the command line or IDLE. I have never built a GUI, and would like to try my hand at creating GUIs that I can run my programs from. Is there a book or tutorial that covers IronPython, IronPython Studio and the dot Net platform that is aimed squarely at the new user? Sincerely Thomas Philips From curt at hagenlocher.org Wed Apr 16 05:03:16 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Tue, 15 Apr 2008 20:03:16 -0700 Subject: [IronPython] Learning IronPython In-Reply-To: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> Message-ID: On Tue, Apr 15, 2008 at 7:32 PM, Thomas Philips wrote: > I program in Python, but my programs are typically run from the > command line or IDLE. I have never built a GUI, and would like to try > my hand at creating GUIs that I can run my programs from. Is there a > book or tutorial that covers IronPython, IronPython Studio and the dot > Net platform that is aimed squarely at the new user? Any book or tutorial about the .NET platform in general will be relevant to IronPython's use of .NET. In fact, taking existing C# or VB examples and translating them into Python may be a good way to leverage your existing Python skills while teaching yourself the .NET class libraries. As far as IronPython-specific resources go, you can't beat the IronPython Cookbook at http://www.ironpython.info/index.php/Main_Page. If you want to see some sample Python code that uses the Windows Forms or Windows Presentation Foundation libraries to produce a GUI, just go to the Contents at http://www.ironpython.info/index.php/Contents and scroll down a bit. -- Curt Hagenlocher curt at hagenlocher.org From idmkid at yahoo.com Wed Apr 16 06:20:05 2008 From: idmkid at yahoo.com (David Seruyange) Date: Tue, 15 Apr 2008 21:20:05 -0700 (PDT) Subject: [IronPython] Learning IronPython Message-ID: <656790.80815.qm@web30802.mail.mud.yahoo.com> Although it's not yet fully available, the Iron Python in Action book will have a chapter devoted to WPF programming with IronPython. Michael's helped me out a lot so I trust the book will be worth the bucks. Find more here: http://www.manning.com/foord/ David ----- Original Message ---- From: Thomas Philips To: users at lists.ironpython.com Sent: Tuesday, April 15, 2008 9:32:06 PM Subject: [IronPython] Learning IronPython I program in Python, but my programs are typically run from the command line or IDLE. I have never built a GUI, and would like to try my hand at creating GUIs that I can run my programs from. Is there a book or tutorial that covers IronPython, IronPython Studio and the dot Net platform that is aimed squarely at the new user? Sincerely Thomas Philips _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Wed Apr 16 11:53:38 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 16 Apr 2008 10:53:38 +0100 Subject: [IronPython] Learning IronPython In-Reply-To: <656790.80815.qm@web30802.mail.mud.yahoo.com> References: <656790.80815.qm@web30802.mail.mud.yahoo.com> Message-ID: <4805CCA2.9090906@voidspace.org.uk> David Seruyange wrote: > Although it's not yet fully available, the Iron Python in Action book > will have a chapter devoted to WPF programming with IronPython. > Michael's helped me out a lot so I trust the book will be worth the > bucks. Find more here: http://www.manning.com/foord/ > Thanks for the plug. There is also a lot about working with Windows Forms in chapters 3 to 6 - which are all available in the early access preview already. The book *should* be a good introduction to both .NET and IronPython. :-) Michael http://www.ironpythoninaction.com/ > David > > ----- Original Message ---- > From: Thomas Philips > To: users at lists.ironpython.com > Sent: Tuesday, April 15, 2008 9:32:06 PM > Subject: [IronPython] Learning IronPython > > I program in Python, but my programs are typically run from the > command line or IDLE. I have never built a GUI, and would like to try > my hand at creating GUIs that I can run my programs from. Is there a > book or tutorial that covers IronPython, IronPython Studio and the dot > Net platform that is aimed squarely at the new user? > > Sincerely > > Thomas Philips > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try > it now. > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From steve at holdenweb.com Wed Apr 16 12:57:42 2008 From: steve at holdenweb.com (Steve Holden) Date: Wed, 16 Apr 2008 06:57:42 -0400 Subject: [IronPython] Learning IronPython In-Reply-To: References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> Message-ID: <4805DBA6.1020201@holdenweb.com> Curt Hagenlocher wrote: > On Tue, Apr 15, 2008 at 7:32 PM, Thomas Philips wrote: >> I program in Python, but my programs are typically run from the >> command line or IDLE. I have never built a GUI, and would like to try >> my hand at creating GUIs that I can run my programs from. Is there a >> book or tutorial that covers IronPython, IronPython Studio and the dot >> Net platform that is aimed squarely at the new user? > > Any book or tutorial about the .NET platform in general will be > relevant to IronPython's use of .NET. In fact, taking existing C# or > VB examples and translating them into Python may be a good way to > leverage your existing Python skills while teaching yourself the .NET > class libraries. > > As far as IronPython-specific resources go, you can't beat the > IronPython Cookbook at http://www.ironpython.info/index.php/Main_Page. > If you want to see some sample Python code that uses the Windows > Forms or Windows Presentation Foundation libraries to produce a GUI, > just go to the Contents at > http://www.ironpython.info/index.php/Contents and scroll down a bit. > Curt: This is such good advice I'd like to quote it in my blog if that's OK with you. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ From curt at hagenlocher.org Wed Apr 16 14:45:00 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 16 Apr 2008 05:45:00 -0700 Subject: [IronPython] Learning IronPython In-Reply-To: <4805DBA6.1020201@holdenweb.com> References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> <4805DBA6.1020201@holdenweb.com> Message-ID: On Wed, Apr 16, 2008 at 3:57 AM, Steve Holden wrote: > > This is such good advice I'd like to quote it in my blog if that's OK > with you. Sure. I don't think it's actually original enough to warrant attribution, but I'd be happy to share the blame for anything that increases the amount of significant whitespace in the world ;). John Liao, for instance, has been blogging at http://jyliao.blogspot.com about translating the examples from Petzold's WPF book into F#. -- Curt Hagenlocher curt at hagenlocher.org From dan.eloff at gmail.com Wed Apr 16 14:47:18 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Wed, 16 Apr 2008 07:47:18 -0500 Subject: [IronPython] Extending .NET Classes Message-ID: <4817b6fc0804160547j67b386e8x3618784413adf490@mail.gmail.com> I think I've already guessed the answer to this one, but I want to hear it from someone else just to be thorough. There's no way to subclass, say Button, as SuperButton and then use in XAML. Maybe if you involve some C#? Certainly you could use SuperButton programmatically and add it to the xaml tree yourself. Currently I've been able to get by in many cases simply by using composition. It looks a little strange to me, but I can use Button in the xaml, and have SuperButton(xaml.myButton) somewhere in the code. There are some things that are difficult to do that way, but so far it works for me. What do you folks do? Thanks, -Dan From curt at hagenlocher.org Wed Apr 16 16:51:15 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 16 Apr 2008 07:51:15 -0700 Subject: [IronPython] Extending .NET Classes In-Reply-To: <4817b6fc0804160547j67b386e8x3618784413adf490@mail.gmail.com> References: <4817b6fc0804160547j67b386e8x3618784413adf490@mail.gmail.com> Message-ID: On Wed, Apr 16, 2008 at 5:47 AM, Dan Eloff wrote: > I think I've already guessed the answer to this one, but I want to > hear it from someone else just to be thorough. > > There's no way to subclass, say Button, as SuperButton and then use > in XAML. Maybe if you involve some C#? The best way to think of XAML is as an object serialization format. The deserializer uses information about the assembly and class in order to create the object at runtime. Because a Python-defined class can't currently exist as a CLR class inside a regular assembly, there's no way for the deserializer to be able to construct an instance of the correct type. Conceptually, you could subclass Button using C# and then forward the calls you're interested in to a Python object. Then you'd use this new class inside the XAML, along with a reference to the applicable Python code. But you'd always be dealing with two separate objects -- the one created by the deserializer and the one created by the DLR. > Currently I've been able to get by in many cases simply by using > composition. It looks a little strange to me, but I can use Button in > the xaml, and > have SuperButton(xaml.myButton) somewhere in the code. There are some > things that are difficult to do that way, but so far it works for me. That's probably because any code can hook the events on the Button; you don't actually have to derive from Button to respond to its events. -- Curt Hagenlocher curt at hagenlocher.org From dan.eloff at gmail.com Wed Apr 16 17:06:15 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Wed, 16 Apr 2008 10:06:15 -0500 Subject: [IronPython] Running an IronPython script with .NET 3.5 Message-ID: <4817b6fc0804160806u52719afo80a80cd92f824ba6@mail.gmail.com> This should be stupidly easy, but I'm not figuring it out. I want to execute a IronPython script from the command line, so I try ipy script.py, but it seems it's only .NET 2*. How to get it to be .NET 3.5? *I assume .NET 2 because running ipy by itself prints: IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433 Thanks, -Dan From miha.valencic at gmail.com Wed Apr 16 17:10:14 2008 From: miha.valencic at gmail.com (Miha Valencic) Date: Wed, 16 Apr 2008 17:10:14 +0200 Subject: [IronPython] Running an IronPython script with .NET 3.5 In-Reply-To: <4817b6fc0804160806u52719afo80a80cd92f824ba6@mail.gmail.com> References: <4817b6fc0804160806u52719afo80a80cd92f824ba6@mail.gmail.com> Message-ID: <233dfa1d0804160810p169d7251kfbc9bc5a5694c2fd@mail.gmail.com> Dan, AFAIK .NET 3.5 is actually .NET 2.0 with added extensions (WCF, WPF, WWF...) on top of it. The CLR version is 2.0. It's a Microsoft thing, calling it .NET 3.5. Miha On Wed, Apr 16, 2008 at 5:06 PM, Dan Eloff wrote: > This should be stupidly easy, but I'm not figuring it out. > > I want to execute a IronPython script from the command line, so I try > ipy script.py, but it seems it's only .NET 2*. How to get it to be > .NET 3.5? > > *I assume .NET 2 because running ipy by itself prints: > > IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.eloff at gmail.com Wed Apr 16 17:23:05 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Wed, 16 Apr 2008 10:23:05 -0500 Subject: [IronPython] Running an IronPython script with .NET 3.5 In-Reply-To: <233dfa1d0804160810p169d7251kfbc9bc5a5694c2fd@mail.gmail.com> References: <4817b6fc0804160806u52719afo80a80cd92f824ba6@mail.gmail.com> <233dfa1d0804160810p169d7251kfbc9bc5a5694c2fd@mail.gmail.com> Message-ID: <4817b6fc0804160823m5684f9b0kaf69ffbc3b90bd29@mail.gmail.com> Well that explains a considerable amount :) What a confusing versioning scheme. Thanks for clearing that up. -Dan On Wed, Apr 16, 2008 at 10:10 AM, Miha Valencic wrote: > Dan, AFAIK .NET 3.5 is actually .NET 2.0 with added extensions (WCF, WPF, > WWF...) on top of it. The CLR version is 2.0. > It's a Microsoft thing, calling it .NET 3.5. > > Miha > > > > On Wed, Apr 16, 2008 at 5:06 PM, Dan Eloff wrote: > > > This should be stupidly easy, but I'm not figuring it out. > > > > I want to execute a IronPython script from the command line, so I try > > ipy script.py, but it seems it's only .NET 2*. How to get it to be > > .NET 3.5? > > > > *I assume .NET 2 because running ipy by itself prints: > > > > IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1433 > > > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From fuzzyman at voidspace.org.uk Wed Apr 16 19:32:36 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 16 Apr 2008 18:32:36 +0100 Subject: [IronPython] More Performance comparisons - dictionary updates and tuples Message-ID: <48063834.8020703@voidspace.org.uk> Hello guys, I've been looking at performance in Resolver One. (Object creation in IronPython seems to be really good whereas dictionary lookups not so good when we compare against CPython.) It turns out that we are getting bitten quite badly by the performance of hashing tuples (fixing this for IP 1.1.2 would be *great*). I did some profiling and have some comparisons - and can also show a regression in performance in IP 2 (Beta 1) when using ints as dictionary keys in an update operation. I thought I would post the results as they may be useful. (Dictionary update in IP 1 with tuple keys is an order of magnitude slower than CPython. So is IP 2 but still twice as good as IP 1 - two times *worse* than IP 1 for tuple creating and unpacking though.) Results first: CPython e:\Dev>timeit1.py tuple_create_and_unpack took 220.999956131 ms dict_update took 541.000127792 ms IP 1.1.1 e:\Dev>e:\Dev\ironpython1\ipy.exe timeit1.py tuple_create_and_unpack took 680.9792 ms dict_update took 7891.3472 ms IP 2 Beta 1 e:\Dev>e:\Dev\ironpython2\ipy.exe timeit1.py tuple_create_and_unpack took 1341.9296 ms dict_update took 4756.84 ms If we switch to using integers rather than tuples for the dictionary keys, the performance changes: CPython e:\Dev>timeit1.py tuple_create_and_unpack took 200.000047684 ms dict_update took 230.999946594 ms IP 1.1.1 e:\Dev>e:\Dev\ironpython1\ipy.exe timeit1.py tuple_create_and_unpack took 911.3104 ms dict_update took 420.6048 ms IP 2 Beta 1 e:\Dev>e:\Dev\ironpython2\ipy.exe timeit1.py tuple_create_and_unpack took 971.3968 ms dict_update took 1582.2752 ms With ints as keys, IP 1 is only half the speed of CPython - but IP 2 is four times slower than IP 1! The code used - which runs under both CPython and IronPython from random import random try: import clr from System import DateTime def timeit(func): start = DateTime.Now func() end = DateTime.Now print func.__name__, 'took %s ms' % (end - start).TotalMilliseconds except ImportError: import time def timeit(func): start = time.time() func() end = time.time() print func.__name__, 'took %s ms' % ((end - start) * 1000) def tuple_create_and_unpack(): for val in range(1000000): a, b = val, val + 1 d1 = {} for x in range(100): for y in range(100): d1[x, y] = random() d2 = {} for x in range(1000): for y in range(1000): d2[x, y] = random() def dict_update(): d1.update(d2) timeit(tuple_create_and_unpack) timeit(dict_update) Michael Foord http://www.ironpythoninaction.com/ From simon.dahlbacka at gmail.com Wed Apr 16 20:01:14 2008 From: simon.dahlbacka at gmail.com (Simon Dahlbacka) Date: Wed, 16 Apr 2008 21:01:14 +0300 Subject: [IronPython] More Performance comparisons - dictionary updates and tuples In-Reply-To: <48063834.8020703@voidspace.org.uk> References: <48063834.8020703@voidspace.org.uk> Message-ID: <57124720804161101m2fbde8c8vd7e3049e79f099fb@mail.gmail.com> > from random import random > > try: > import clr > from System import DateTime > > def timeit(func): > start = DateTime.Now > func() > end = DateTime.Now > print func.__name__, 'took %s ms' % (end - start).TotalMilliseconds Just a small nitpick or whatever, you might want to consider using the System.Diagnostics.StopWatch class as it "Provides a set of methods and properties that you can use to accurately measure elapsed time." i.e. try: import clr from System.Diagnostics import StopWatch def timeit(func): watch = StopWatch() watch.Start() func() watch.Stop() print func.__name__, 'took %s ms' % watch.Elapsed.TotalMilliseconds -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Wed Apr 16 20:09:25 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 16 Apr 2008 19:09:25 +0100 Subject: [IronPython] More Performance comparisons - dictionary updates and tuples In-Reply-To: <57124720804161101m2fbde8c8vd7e3049e79f099fb@mail.gmail.com> References: <48063834.8020703@voidspace.org.uk> <57124720804161101m2fbde8c8vd7e3049e79f099fb@mail.gmail.com> Message-ID: <480640D5.9040309@voidspace.org.uk> Simon Dahlbacka wrote: > > from random import random > > try: > import clr > from System import DateTime > > def timeit(func): > start = DateTime.Now > func() > end = DateTime.Now > print func.__name__, 'took %s ms' % (end - > start).TotalMilliseconds > > > Just a small nitpick or whatever, you might want to consider using the > System.Diagnostics.StopWatch class as it "Provides a set of methods > and properties that you can use to accurately measure elapsed time." Sure - DateTime has a granularity of 10-15ms, which I thought was accurate enough for this. Thanks Michael > > i.e. > > try: > import clr > from System.Diagnostics import StopWatch > > def timeit(func): > watch = StopWatch() > watch.Start() > func() > watch.Stop() > print func.__name__, 'took %s ms' % watch.Elapsed.TotalMilliseconds > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From kar at musc.edu Wed Apr 16 21:01:15 2008 From: kar at musc.edu (Kar, Sujit) Date: Wed, 16 Apr 2008 15:01:15 -0400 Subject: [IronPython] POP3_SSL issue Message-ID: Hello, I am trying to access gmail via the POP3_SSL standard python library. Ironpython is installed & so is Python2.5 and site.py has the necessay path information. OS is Vista When I try to execute the following code in IronPython: mbox = poplib.POP3_SSL("pop.gmail.com") I get an error message saying: AttributeError: 'module' object has no attribute 'ssl' If I use the python console installed with Python2.5, everything works just fine. Any ideas? I just started using python/ironpython, so please excuse any newbie mistakes. Thanks, Sujit -=- From fuzzyman at voidspace.org.uk Wed Apr 16 21:03:17 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 16 Apr 2008 20:03:17 +0100 Subject: [IronPython] POP3_SSL issue In-Reply-To: References: Message-ID: <48064D75.6030208@voidspace.org.uk> Kar, Sujit wrote: > Hello, > > I am trying to access gmail via the POP3_SSL standard python library. Ironpython is installed & so is Python2.5 and site.py has the necessay path information. OS is Vista > > When I try to execute the following code in IronPython: > > mbox = poplib.POP3_SSL("pop.gmail.com") > > I get an error message saying: > AttributeError: 'module' object has no attribute 'ssl' > > What is the line of Python code associated with that error (it should be in the full traceback). I suspect that will give you a clue. :-) The answer is probably that Python uses a c extension module for ssl support. Michael Foord http://www.ironpythoninaction.com/ > If I use the python console installed with Python2.5, everything works just fine. > > Any ideas? > > I just started using python/ironpython, so please excuse any newbie mistakes. > > Thanks, > Sujit > -=- > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From kar at musc.edu Wed Apr 16 21:20:03 2008 From: kar at musc.edu (Kar, Sujit) Date: Wed, 16 Apr 2008 15:20:03 -0400 Subject: [IronPython] POP3_SSL issue In-Reply-To: <48064D75.6030208@voidspace.org.uk> References: , <48064D75.6030208@voidspace.org.uk> Message-ID: Michael, The full trace is: Traceback (most recent call last): File , line 0, in ##76 File c:\python25\lib\poplib.py, line 359, in __init__ AttributeError: 'module' object has no attribute 'ssl' If it is an extension module, then does that mean I cannot use IronPython to do this? Thanks for your help... Sujit -=- ________________________________________ From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] Sent: Wednesday, April 16, 2008 3:03 PM To: Discussion of IronPython Subject: Re: [IronPython] POP3_SSL issue Kar, Sujit wrote: > Hello, > > I am trying to access gmail via the POP3_SSL standard python library. Ironpython is installed & so is Python2.5 and site.py has the necessay path information. OS is Vista > > When I try to execute the following code in IronPython: > > mbox = poplib.POP3_SSL("pop.gmail.com") > > I get an error message saying: > AttributeError: 'module' object has no attribute 'ssl' > > What is the line of Python code associated with that error (it should be in the full traceback). I suspect that will give you a clue. :-) The answer is probably that Python uses a c extension module for ssl support. Michael Foord http://www.ironpythoninaction.com/ > If I use the python console installed with Python2.5, everything works just fine. > > Any ideas? > > I just started using python/ironpython, so please excuse any newbie mistakes. > > Thanks, > Sujit > -=- > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From tkpmep at gmail.com Wed Apr 16 21:21:59 2008 From: tkpmep at gmail.com (Thomas Philips) Date: Wed, 16 Apr 2008 12:21:59 -0700 (PDT) Subject: [IronPython] Learning IronPython In-Reply-To: References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> <4805DBA6.1020201@holdenweb.com> Message-ID: <058510f7-cd6d-4815-9278-5b52f473f36e@u69g2000hse.googlegroups.com> Thank you, all, for the pointers. The IronPython cookbook appears to be exactly what I need right now, and I'll purchase the book by Michael Foord as soon as it is published. Thomas Philips From fuzzyman at voidspace.org.uk Wed Apr 16 21:35:46 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 16 Apr 2008 20:35:46 +0100 Subject: [IronPython] POP3_SSL issue In-Reply-To: References: , <48064D75.6030208@voidspace.org.uk> Message-ID: <48065512.1020801@voidspace.org.uk> Kar, Sujit wrote: > Michael, > > The full trace is: > > Traceback (most recent call last): > File , line 0, in ##76 > File c:\python25\lib\poplib.py, line 359, in __init__ > AttributeError: 'module' object has no attribute 'ssl' > > If it is an extension module, then does that mean I cannot use IronPython to do this? > Not using that standard library module as it is. You'd need to wrap a .NET SSL module to provide a similar interface - or use another .NET library to provide the POP3 SSL functionality you want. Michael Foord http://www.ironpythoninaction.com/ > Thanks for your help... > > Sujit > -=- > > > ________________________________________ > From: users-bounces at lists.ironpython.com [users-bounces at lists.ironpython.com] On Behalf Of Michael Foord [fuzzyman at voidspace.org.uk] > Sent: Wednesday, April 16, 2008 3:03 PM > To: Discussion of IronPython > Subject: Re: [IronPython] POP3_SSL issue > > Kar, Sujit wrote: > >> Hello, >> >> I am trying to access gmail via the POP3_SSL standard python library. Ironpython is installed & so is Python2.5 and site.py has the necessay path information. OS is Vista >> >> When I try to execute the following code in IronPython: >> >> mbox = poplib.POP3_SSL("pop.gmail.com") >> >> I get an error message saying: >> AttributeError: 'module' object has no attribute 'ssl' >> >> >> > > What is the line of Python code associated with that error (it should be > in the full traceback). I suspect that will give you a clue. :-) > > The answer is probably that Python uses a c extension module for ssl > support. > > Michael Foord > http://www.ironpythoninaction.com/ > > >> If I use the python console installed with Python2.5, everything works just fine. >> >> Any ideas? >> >> I just started using python/ironpython, so please excuse any newbie mistakes. >> >> Thanks, >> Sujit >> -=- >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From tkapoor at wscm.net Wed Apr 16 21:35:39 2008 From: tkapoor at wscm.net (Tarun Kapoor) Date: Wed, 16 Apr 2008 14:35:39 -0500 Subject: [IronPython] Learning IronPython In-Reply-To: <058510f7-cd6d-4815-9278-5b52f473f36e@u69g2000hse.googlegroups.com> References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> <4805DBA6.1020201@holdenweb.com> <058510f7-cd6d-4815-9278-5b52f473f36e@u69g2000hse.googlegroups.com> Message-ID: Michael - do you have a date on when you book is coming out ? Tarun Kapoor Waterstone Capital -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Thomas Philips Sent: Wednesday, April 16, 2008 2:22 PM To: users at lists.ironpython.com Subject: Re: [IronPython] Learning IronPython Thank you, all, for the pointers. The IronPython cookbook appears to be exactly what I need right now, and I'll purchase the book by Michael Foord as soon as it is published. Thomas Philips _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com Disclaimer This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with the sender. From curt at hagenlocher.org Wed Apr 16 21:37:58 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 16 Apr 2008 12:37:58 -0700 Subject: [IronPython] POP3_SSL issue In-Reply-To: References: <48064D75.6030208@voidspace.org.uk> Message-ID: On Wed, Apr 16, 2008 at 12:20 PM, Kar, Sujit wrote: > > Traceback (most recent call last): > File , line 0, in ##76 > File c:\python25\lib\poplib.py, line 359, in __init__ > AttributeError: 'module' object has no attribute 'ssl' > > If it is an extension module, then does that mean I cannot use IronPython to do this? In general, IronPython cannot use binary extensions that were created for Python. There's a project aimed at overcoming this limitation; see http://www.voidspace.org.uk/ironpython/cpython_extensions.shtml for more details. You would probably have get a bit hands-on to make this work with the _ssl module that's part of CPython. As I understand it, the goal of IronPython is to provide as much CPython compatibility as possible, with priorities determined at least in part by community input. There doesn't yet appear to be a work item for SSL support at CodePlex, so maybe you'll want to go to http://www.codeplex.com/IronPython/WorkItem/List.aspx and add it. Others will then have the opportunity to vote on the work item and express their support for its implementation. -- Curt Hagenlocher curt at hagenlocher.org From fuzzyman at voidspace.org.uk Wed Apr 16 21:40:03 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 16 Apr 2008 20:40:03 +0100 Subject: [IronPython] Learning IronPython In-Reply-To: References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> <4805DBA6.1020201@holdenweb.com> <058510f7-cd6d-4815-9278-5b52f473f36e@u69g2000hse.googlegroups.com> Message-ID: <48065613.6050001@voidspace.org.uk> Tarun Kapoor wrote: > Michael - do you have a date on when you book is coming out ? > Hopefully July / August. There is already early access to the first 9 chapters (with more coming soon) via the early access program. Michael http://www.ironpythoninaction.com/ > Tarun Kapoor > Waterstone Capital > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Thomas Philips > Sent: Wednesday, April 16, 2008 2:22 PM > To: users at lists.ironpython.com > Subject: Re: [IronPython] Learning IronPython > > > > Thank you, all, for the pointers. The IronPython cookbook appears to > be exactly what I need right now, and I'll purchase the book by > Michael Foord as soon as it is published. > > Thomas Philips > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > Disclaimer > > This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with the > sender. > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From kar at musc.edu Wed Apr 16 21:46:05 2008 From: kar at musc.edu (Kar, Sujit) Date: Wed, 16 Apr 2008 15:46:05 -0400 Subject: [IronPython] POP3_SSL issue In-Reply-To: References: <48064D75.6030208@voidspace.org.uk> Message-ID: Thank you Curt and Michael for the explanation... I think the best thing to do for the time being would be to simply use CPython to get the data I need from the gmail mailboxes and let IronPython kick in after that. The processing is sequential, so a batch file to run the processes back to back will work well. Thanks again. Sujit -=- -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Wednesday, April 16, 2008 3:38 PM To: Discussion of IronPython Subject: Re: [IronPython] POP3_SSL issue On Wed, Apr 16, 2008 at 12:20 PM, Kar, Sujit wrote: > > Traceback (most recent call last): > File , line 0, in ##76 > File c:\python25\lib\poplib.py, line 359, in __init__ > AttributeError: 'module' object has no attribute 'ssl' > > If it is an extension module, then does that mean I cannot use IronPython to do this? In general, IronPython cannot use binary extensions that were created for Python. There's a project aimed at overcoming this limitation; see http://www.voidspace.org.uk/ironpython/cpython_extensions.shtml for more details. You would probably have get a bit hands-on to make this work with the _ssl module that's part of CPython. As I understand it, the goal of IronPython is to provide as much CPython compatibility as possible, with priorities determined at least in part by community input. There doesn't yet appear to be a work item for SSL support at CodePlex, so maybe you'll want to go to http://www.codeplex.com/IronPython/WorkItem/List.aspx and add it. Others will then have the opportunity to vote on the work item and express their support for its implementation. -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From ben2004uk at googlemail.com Thu Apr 17 00:43:35 2008 From: ben2004uk at googlemail.com (Ben Hall) Date: Wed, 16 Apr 2008 23:43:35 +0100 Subject: [IronPython] Learning IronPython In-Reply-To: <48065613.6050001@voidspace.org.uk> References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> <4805DBA6.1020201@holdenweb.com> <058510f7-cd6d-4815-9278-5b52f473f36e@u69g2000hse.googlegroups.com> <48065613.6050001@voidspace.org.uk> Message-ID: I've purchased Michael's book, read first 3 chapters - very good. It really is worth getting it now and getting ahead start :) On Wed, Apr 16, 2008 at 8:40 PM, Michael Foord wrote: > Tarun Kapoor wrote: > > Michael - do you have a date on when you book is coming out ? > > > Hopefully July / August. There is already early access to the first 9 > chapters (with more coming soon) via the early access program. > > > Michael > http://www.ironpythoninaction.com/ > > > > > Tarun Kapoor > > Waterstone Capital > > > > -----Original Message----- > > From: users-bounces at lists.ironpython.com > > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Thomas Philips > > Sent: Wednesday, April 16, 2008 2:22 PM > > To: users at lists.ironpython.com > > Subject: Re: [IronPython] Learning IronPython > > > > > > > > Thank you, all, for the pointers. The IronPython cookbook appears to > > be exactly what I need right now, and I'll purchase the book by > > Michael Foord as soon as it is published. > > > > Thomas Philips > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > Disclaimer > > > > This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with th > e > > sender. > > > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Thu Apr 17 00:52:41 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 16 Apr 2008 23:52:41 +0100 Subject: [IronPython] Learning IronPython In-Reply-To: References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> <4805DBA6.1020201@holdenweb.com> <058510f7-cd6d-4815-9278-5b52f473f36e@u69g2000hse.googlegroups.com> <48065613.6050001@voidspace.org.uk> Message-ID: <48068339.6030407@voidspace.org.uk> Ben Hall wrote: > I've purchased Michael's book, read first 3 chapters - very good. It > really is worth getting it now and getting ahead start :) > > Only the first three chapters - what have you been up to Ben. ;-) Michael > On Wed, Apr 16, 2008 at 8:40 PM, Michael Foord > wrote: > >> Tarun Kapoor wrote: >> > Michael - do you have a date on when you book is coming out ? >> > >> Hopefully July / August. There is already early access to the first 9 >> chapters (with more coming soon) via the early access program. >> >> >> Michael >> http://www.ironpythoninaction.com/ >> >> >> >> >>> Tarun Kapoor >>> >> > Waterstone Capital >> > >> > -----Original Message----- >> > From: users-bounces at lists.ironpython.com >> > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Thomas Philips >> > Sent: Wednesday, April 16, 2008 2:22 PM >> > To: users at lists.ironpython.com >> > Subject: Re: [IronPython] Learning IronPython >> > >> > >> > >> > Thank you, all, for the pointers. The IronPython cookbook appears to >> > be exactly what I need right now, and I'll purchase the book by >> > Michael Foord as soon as it is published. >> > >> > Thomas Philips >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >> > >> > Disclaimer >> > >> > This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with >> > th > >> e >> > sender. >> > >> > >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From ben2004uk at googlemail.com Thu Apr 17 01:47:41 2008 From: ben2004uk at googlemail.com (Ben Hall) Date: Thu, 17 Apr 2008 00:47:41 +0100 Subject: [IronPython] Learning IronPython In-Reply-To: <48068339.6030407@voidspace.org.uk> References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> <4805DBA6.1020201@holdenweb.com> <058510f7-cd6d-4815-9278-5b52f473f36e@u69g2000hse.googlegroups.com> <48065613.6050001@voidspace.org.uk> <48068339.6030407@voidspace.org.uk> Message-ID: Asking you loads of questions - haven't you noticed :) On Wed, Apr 16, 2008 at 11:52 PM, Michael Foord wrote: > Ben Hall wrote: > > I've purchased Michael's book, read first 3 chapters - very good. It > > really is worth getting it now and getting ahead start :) > > > > > > Only the first three chapters - what have you been up to Ben. ;-) > > Michael > > > > > On Wed, Apr 16, 2008 at 8:40 PM, Michael Foord > > wrote: > > > >> Tarun Kapoor wrote: > >> > Michael - do you have a date on when you book is coming out ? > >> > > >> Hopefully July / August. There is already early access to the first 9 > >> chapters (with more coming soon) via the early access program. > >> > >> > >> Michael > >> http://www.ironpythoninaction.com/ > >> > >> > >> > >> > >>> Tarun Kapoor > >>> > >> > Waterstone Capital > >> > > >> > -----Original Message----- > >> > From: users-bounces at lists.ironpython.com > >> > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Thomas Philips > >> > Sent: Wednesday, April 16, 2008 2:22 PM > >> > To: users at lists.ironpython.com > >> > Subject: Re: [IronPython] Learning IronPython > >> > > >> > > >> > > >> > Thank you, all, for the pointers. The IronPython cookbook appears to > >> > be exactly what I need right now, and I'll purchase the book by > >> > Michael Foord as soon as it is published. > >> > > >> > Thomas Philips > >> > _______________________________________________ > >> > Users mailing list > >> > Users at lists.ironpython.com > >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > > >> > > >> > Disclaimer > >> > > >> > This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity wit > h > >> > > th > > > >> e > >> > sender. > >> > > >> > > >> > _______________________________________________ > >> > Users mailing list > >> > Users at lists.ironpython.com > >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > > >> > >> > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > >> > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Thu Apr 17 01:52:33 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 16 Apr 2008 16:52:33 -0700 Subject: [IronPython] More Performance comparisons - dictionary updates and tuples In-Reply-To: <48063834.8020703@voidspace.org.uk> References: <48063834.8020703@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C22270124ED7FF6C3@DF-GRTDANE-MSG.exchange.corp.microsoft.com> I'll have to look at these closer but I suspect fixing dict update performance will be a trivial change. We currently just go through some overly generic code path which works for any IDictionary. Unfortunately when used against a PythonDictionary we're going through a code path which is making a copy of all the members into a list, getting an enumerator for that list, and then copying the members into the new dictionary. Not exactly the fastest thing in the world and likely a regression caused directly from the new dictionary implementation... The tuple hashing is better in Beta 1 then it was before (due to your feedback! :)) but it's still not perfect. I ran into a test case in the standard library the other day which is verifying the # of collisions is below 15 or something like that and we were still getting thousands of collisions in that test. So that still deserves another iteration. The regressions w/ ints and tuple assignment certainly deserve a good investigation as well - hopefully it's just something silly that got broken. :) I'll try and get to these tomorrow but if I don't I'll open a bug just so it doesn't get lost. Are there any other issues that you or anyone else would like to see for 1.1.2? We've currently only got 2 other issues up on CodePlex marked for 1.1.2 right now. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Wednesday, April 16, 2008 10:33 AM To: Discussion of IronPython Subject: [IronPython] More Performance comparisons - dictionary updates and tuples Hello guys, I've been looking at performance in Resolver One. (Object creation in IronPython seems to be really good whereas dictionary lookups not so good when we compare against CPython.) It turns out that we are getting bitten quite badly by the performance of hashing tuples (fixing this for IP 1.1.2 would be *great*). I did some profiling and have some comparisons - and can also show a regression in performance in IP 2 (Beta 1) when using ints as dictionary keys in an update operation. I thought I would post the results as they may be useful. (Dictionary update in IP 1 with tuple keys is an order of magnitude slower than CPython. So is IP 2 but still twice as good as IP 1 - two times *worse* than IP 1 for tuple creating and unpacking though.) Results first: CPython e:\Dev>timeit1.py tuple_create_and_unpack took 220.999956131 ms dict_update took 541.000127792 ms IP 1.1.1 e:\Dev>e:\Dev\ironpython1\ipy.exe timeit1.py tuple_create_and_unpack took 680.9792 ms dict_update took 7891.3472 ms IP 2 Beta 1 e:\Dev>e:\Dev\ironpython2\ipy.exe timeit1.py tuple_create_and_unpack took 1341.9296 ms dict_update took 4756.84 ms If we switch to using integers rather than tuples for the dictionary keys, the performance changes: CPython e:\Dev>timeit1.py tuple_create_and_unpack took 200.000047684 ms dict_update took 230.999946594 ms IP 1.1.1 e:\Dev>e:\Dev\ironpython1\ipy.exe timeit1.py tuple_create_and_unpack took 911.3104 ms dict_update took 420.6048 ms IP 2 Beta 1 e:\Dev>e:\Dev\ironpython2\ipy.exe timeit1.py tuple_create_and_unpack took 971.3968 ms dict_update took 1582.2752 ms With ints as keys, IP 1 is only half the speed of CPython - but IP 2 is four times slower than IP 1! The code used - which runs under both CPython and IronPython from random import random try: import clr from System import DateTime def timeit(func): start = DateTime.Now func() end = DateTime.Now print func.__name__, 'took %s ms' % (end - start).TotalMilliseconds except ImportError: import time def timeit(func): start = time.time() func() end = time.time() print func.__name__, 'took %s ms' % ((end - start) * 1000) def tuple_create_and_unpack(): for val in range(1000000): a, b = val, val + 1 d1 = {} for x in range(100): for y in range(100): d1[x, y] = random() d2 = {} for x in range(1000): for y in range(1000): d2[x, y] = random() def dict_update(): d1.update(d2) timeit(tuple_create_and_unpack) timeit(dict_update) Michael Foord http://www.ironpythoninaction.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dan.eloff at gmail.com Thu Apr 17 04:58:47 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Wed, 16 Apr 2008 21:58:47 -0500 Subject: [IronPython] Silverlight, cannot import os module? Message-ID: <4817b6fc0804161958l3fc77d84n2742b5a6ce127549@mail.gmail.com> I've added os.py and ntpath.py to my .xap, but the trouble is os uses sys.builtin_module_names to detect platform, and there is no platform specific module in there for silverlight. Maybe it is os.py (using CPython 2.5 version) that needs to be changed to support a silverlight platform? Or to stop throwing when no platform detected? Or maybe IronPython should have a minimal or empty nt builtin module for silverlight, since probably that's the closest to the desired behavior. Surely somebody else has come across this? I'm going to hack os.py for now to allow me to continue past this. Thanks, -Dan From fuzzyman at voidspace.org.uk Thu Apr 17 12:06:43 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 17 Apr 2008 11:06:43 +0100 Subject: [IronPython] Silverlight, cannot import os module? In-Reply-To: <4817b6fc0804161958l3fc77d84n2742b5a6ce127549@mail.gmail.com> References: <4817b6fc0804161958l3fc77d84n2742b5a6ce127549@mail.gmail.com> Message-ID: <48072133.8090309@voidspace.org.uk> Dan Eloff wrote: > I've added os.py and ntpath.py to my .xap, but the trouble is os uses > sys.builtin_module_names to detect platform, and there is no platform > specific module in there for silverlight. > > Maybe it is os.py (using CPython 2.5 version) that needs to be changed > to support a silverlight platform? Or to stop throwing when no > platform detected? > > Or maybe IronPython should have a minimal or empty nt builtin module > for silverlight, since probably that's the closest to the desired > behavior. > > Surely somebody else has come across this? I'm going to hack os.py for > now to allow me to continue past this. > Out of interest - what features of os do you want to use? You could post a bug on the Python tracker that os.py fails to import on platforms with no 'platform' (and mention that it is in SIlverlight). A patch would be good too. Michael Foord http://www.ironpythoninaction.com/ > Thanks, > -Dan > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Thu Apr 17 12:08:48 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 17 Apr 2008 11:08:48 +0100 Subject: [IronPython] Learning IronPython In-Reply-To: References: <67ba8307-1ad3-4637-9322-a0cc8bcf8685@m36g2000hse.googlegroups.com> <4805DBA6.1020201@holdenweb.com> <058510f7-cd6d-4815-9278-5b52f473f36e@u69g2000hse.googlegroups.com> <48065613.6050001@voidspace.org.uk> <48068339.6030407@voidspace.org.uk> Message-ID: <480721B0.4030802@voidspace.org.uk> Ben Hall wrote: > Asking you loads of questions - haven't you noticed :) > The later chapter on testing in IronPython may interest you particularly. Michael > On Wed, Apr 16, 2008 at 11:52 PM, Michael Foord > wrote: > >> Ben Hall wrote: >> > I've purchased Michael's book, read first 3 chapters - very good. It >> > really is worth getting it now and getting ahead start :) >> > >> > >> >> Only the first three chapters - what have you been up to Ben. ;-) >> >> Michael >> >> >> >> > On Wed, Apr 16, 2008 at 8:40 PM, Michael Foord >> > wrote: >> > >> >> Tarun Kapoor wrote: >> >> > Michael - do you have a date on when you book is coming out ? >> >> > >> >> Hopefully July / August. There is already early access to the first 9 >> >> chapters (with more coming soon) via the early access program. >> >> >> >> >> >> Michael >> >> http://www.ironpythoninaction.com/ >> >> >> >> >> >> >> >> >> >>> Tarun Kapoor >> >>> >> >> > Waterstone Capital >> >> > >> >> > -----Original Message----- >> >> > From: users-bounces at lists.ironpython.com >> >> > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Thomas Philips >> >> > Sent: Wednesday, April 16, 2008 2:22 PM >> >> > To: users at lists.ironpython.com >> >> > Subject: Re: [IronPython] Learning IronPython >> >> > >> >> > >> >> > >> >> > Thank you, all, for the pointers. The IronPython cookbook appears to >> >> > be exactly what I need right now, and I'll purchase the book by >> >> > Michael Foord as soon as it is published. >> >> > >> >> > Thomas Philips >> >> > _______________________________________________ >> >> > Users mailing list >> >> > Users at lists.ironpython.com >> >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > >> >> > >> >> > Disclaimer >> >> > >> >> > This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity >> > wit > >> h >> >> >> > th >> > >> >> e >> >> > sender. >> >> > >> >> > >> >> > _______________________________________________ >> >> > Users mailing list >> >> > Users at lists.ironpython.com >> >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > >> >> >> >> >> >> _______________________________________________ >> >> Users mailing list >> >> Users at lists.ironpython.com >> >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >> >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Thu Apr 17 12:56:43 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 17 Apr 2008 11:56:43 +0100 Subject: [IronPython] Updates for 1.1.2 Message-ID: <48072CEB.7040303@voidspace.org.uk> Hello all, Off the top of my head the only bugfixes I can *remember* that I would like to see in 1.1.2 are: * Compiled regular expression perf fix * Further socket fixes * Tuple hashing improvement * PyCF_DONT_IMPLY_DEDENT (or whatever it was) support in compile * Array objects don't have methods when clr not imported (I don't *think* this was addressed in 1.1.1 but may be wrong) I'll try and look through and see if I can spot some more. Michael From fuzzyman at voidspace.org.uk Thu Apr 17 14:00:39 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 17 Apr 2008 13:00:39 +0100 Subject: [IronPython] Updates for 1.1.2 In-Reply-To: <48072CEB.7040303@voidspace.org.uk> References: <48072CEB.7040303@voidspace.org.uk> Message-ID: <48073BE7.9080407@voidspace.org.uk> More candidates. These have affected us at Resolver: #10983 Reading files in text mode reads chars > 0x7F as '?' SyntaxError doesnt get lineno (or other properties) when created by user code #14882 Trivial: Implement float.__lt__(float) (and friends...) #10709 Using lambda in class definition will add into the class's dictionary #11133 Implicit conversion operators not supported #7011 Caching of generated IL to disk for packages These look like good ones to backport as well: #11487 __str__ does not call __repr__ in new style classes #10291 calling base class __call__ invokes constructor instead #2443 problem with __slots__ and __init__ in new-style classes #11812 dir(bool), dir(True), dir(False) raise SystemError on startup #1402 try-finally has an issue in generator #10580 "type in (None,)" throws a SystemError #8361 Trivial: popen shouldn't open new window #2704 __import__ and packages aren't mixing well #8780 Removes the inexistent file did not throw OSError in IP #8297 range w/ large negative number produces incorrect results #9351 int() doesn't convert representable longs to int #3117 dict.update doesn't take keyword arguments - differs from CPython #4197 Trivial: int('0x20', 16) fails to parse, long too #4322 unpacking single element tuples in for-statement, listcomp and generator #5447 socket.getnameinfo(...) broken under Vista #5083 operator.__contains__ is broken #13686 Using setattr with modules #13651 importing package with imp module #5801 Class with slots and getattr not compatible #14861 Value types don't work when a function is called twice I hope that gives you enough to work on... Michael Michael Foord wrote: > Hello all, > > Off the top of my head the only bugfixes I can *remember* that I would > like to see in 1.1.2 are: > > * Compiled regular expression perf fix > * Further socket fixes > * Tuple hashing improvement > * PyCF_DONT_IMPLY_DEDENT (or whatever it was) support in compile > * Array objects don't have methods when clr not imported (I don't > *think* this was addressed in 1.1.1 but may be wrong) > > I'll try and look through and see if I can spot some more. > > Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dan.eloff at gmail.com Thu Apr 17 17:37:56 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Thu, 17 Apr 2008 10:37:56 -0500 Subject: [IronPython] Silverlight, cannot import os module? In-Reply-To: <48072133.8090309@voidspace.org.uk> References: <4817b6fc0804161958l3fc77d84n2742b5a6ce127549@mail.gmail.com> <48072133.8090309@voidspace.org.uk> Message-ID: <4817b6fc0804170837k1b50d7c9y44571c240d70e46@mail.gmail.com> Actually, asside from os.linesep, (which could be easily replaced) I don't see anything that I would use, it was primarily because I was trying to get linecache working in silverlight, but I gave up on that and used (yours? fuzzymans?) traceback module without linecache. It'd be nice to have os with almost no features for modules that import it, so that you can use their non-os-using parts, but I can't think of one real life example of a module like that. -Dan On Thu, Apr 17, 2008 at 5:06 AM, Michael Foord wrote: > > Dan Eloff wrote: > > I've added os.py and ntpath.py to my .xap, but the trouble is os uses > > sys.builtin_module_names to detect platform, and there is no platform > > specific module in there for silverlight. > > > > Maybe it is os.py (using CPython 2.5 version) that needs to be changed > > to support a silverlight platform? Or to stop throwing when no > > platform detected? > > > > Or maybe IronPython should have a minimal or empty nt builtin module > > for silverlight, since probably that's the closest to the desired > > behavior. > > > > Surely somebody else has come across this? I'm going to hack os.py for > > now to allow me to continue past this. > > > > Out of interest - what features of os do you want to use? > > You could post a bug on the Python tracker that os.py fails to import on > platforms with no 'platform' (and mention that it is in SIlverlight). A > patch would be good too. > > Michael Foord > http://www.ironpythoninaction.com/ > > > Thanks, > > -Dan > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Thu Apr 17 17:44:25 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 17 Apr 2008 08:44:25 -0700 Subject: [IronPython] Updates for 1.1.2 In-Reply-To: <48073BE7.9080407@voidspace.org.uk> References: <48072CEB.7040303@voidspace.org.uk> <48073BE7.9080407@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C22270124ED7FF7A4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> This is a great list, thanks! Anyone else? -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Thursday, April 17, 2008 5:01 AM To: Discussion of IronPython Subject: Re: [IronPython] Updates for 1.1.2 More candidates. These have affected us at Resolver: #10983 Reading files in text mode reads chars > 0x7F as '?' SyntaxError doesnt get lineno (or other properties) when created by user code #14882 Trivial: Implement float.__lt__(float) (and friends...) #10709 Using lambda in class definition will add into the class's dictionary #11133 Implicit conversion operators not supported #7011 Caching of generated IL to disk for packages These look like good ones to backport as well: #11487 __str__ does not call __repr__ in new style classes #10291 calling base class __call__ invokes constructor instead #2443 problem with __slots__ and __init__ in new-style classes #11812 dir(bool), dir(True), dir(False) raise SystemError on startup #1402 try-finally has an issue in generator #10580 "type in (None,)" throws a SystemError #8361 Trivial: popen shouldn't open new window #2704 __import__ and packages aren't mixing well #8780 Removes the inexistent file did not throw OSError in IP #8297 range w/ large negative number produces incorrect results #9351 int() doesn't convert representable longs to int #3117 dict.update doesn't take keyword arguments - differs from CPython #4197 Trivial: int('0x20', 16) fails to parse, long too #4322 unpacking single element tuples in for-statement, listcomp and generator #5447 socket.getnameinfo(...) broken under Vista #5083 operator.__contains__ is broken #13686 Using setattr with modules #13651 importing package with imp module #5801 Class with slots and getattr not compatible #14861 Value types don't work when a function is called twice I hope that gives you enough to work on... Michael Michael Foord wrote: > Hello all, > > Off the top of my head the only bugfixes I can *remember* that I would > like to see in 1.1.2 are: > > * Compiled regular expression perf fix > * Further socket fixes > * Tuple hashing improvement > * PyCF_DONT_IMPLY_DEDENT (or whatever it was) support in compile > * Array objects don't have methods when clr not imported (I don't > *think* this was addressed in 1.1.1 but may be wrong) > > I'll try and look through and see if I can spot some more. > > Michael > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Thu Apr 17 18:34:39 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 17 Apr 2008 17:34:39 +0100 Subject: [IronPython] Silverlight, cannot import os module? In-Reply-To: <4817b6fc0804170837k1b50d7c9y44571c240d70e46@mail.gmail.com> References: <4817b6fc0804161958l3fc77d84n2742b5a6ce127549@mail.gmail.com> <48072133.8090309@voidspace.org.uk> <4817b6fc0804170837k1b50d7c9y44571c240d70e46@mail.gmail.com> Message-ID: <48077C1F.9040604@voidspace.org.uk> Dan Eloff wrote: > Actually, asside from os.linesep, (which could be easily replaced) I > don't see anything that I would use, I don't see why you would need linesep as you have no access to the filesystem. > it was primarily because I was > trying to get linecache working in silverlight, but I gave up on that > and used (yours? fuzzymans?) traceback module without linecache. It'd > be nice to have os with almost no features for modules that import it, > so that you can use their non-os-using parts, but I can't think of one > real life example of a module like that. > > Creating a stub module for this purpose should be easy. Michael > -Dan > > On Thu, Apr 17, 2008 at 5:06 AM, Michael Foord > wrote: > >> Dan Eloff wrote: >> > I've added os.py and ntpath.py to my .xap, but the trouble is os uses >> > sys.builtin_module_names to detect platform, and there is no platform >> > specific module in there for silverlight. >> > >> > Maybe it is os.py (using CPython 2.5 version) that needs to be changed >> > to support a silverlight platform? Or to stop throwing when no >> > platform detected? >> > >> > Or maybe IronPython should have a minimal or empty nt builtin module >> > for silverlight, since probably that's the closest to the desired >> > behavior. >> > >> > Surely somebody else has come across this? I'm going to hack os.py for >> > now to allow me to continue past this. >> > >> >> Out of interest - what features of os do you want to use? >> >> You could post a bug on the Python tracker that os.py fails to import on >> platforms with no 'platform' (and mention that it is in SIlverlight). A >> patch would be good too. >> >> Michael Foord >> http://www.ironpythoninaction.com/ >> >> > Thanks, >> > -Dan >> > _______________________________________________ >> > Users mailing list >> > Users at lists.ironpython.com >> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From idmkid at yahoo.com Thu Apr 17 19:58:34 2008 From: idmkid at yahoo.com (David Seruyange) Date: Thu, 17 Apr 2008 10:58:34 -0700 (PDT) Subject: [IronPython] Redirecting input/output in IronPython 2.x Message-ID: <320411.79349.qm@web30808.mail.mud.yahoo.com> Hey everyone, looking at a lot of the samples online I see the following: pythonEngine.SetStandardError(s); pythonEngine.SetStandardOutput(s);where s is some stream. The Python Engine doesn't seem to support that method when I make a reference to IronPython 2.0. Am I missing something or are the online resources now obsolete? Thanks much - David ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Thu Apr 17 20:07:42 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 17 Apr 2008 11:07:42 -0700 Subject: [IronPython] Redirecting input/output in IronPython 2.x In-Reply-To: <320411.79349.qm@web30808.mail.mud.yahoo.com> References: <320411.79349.qm@web30808.mail.mud.yahoo.com> Message-ID: <7AD436E4270DD54A94238001769C22270124ED7FF83F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> You want ScriptRuntime.IO.SetOutput/ScriptRuntime.IO.SetError which will let you set the I/O used for all the ScriptEngine's running in the given ScriptRuntime. You also now need to provide either a Stream and an Encoding or a Stream and a TextWriter. The reason for that is to support both text and binary output for scenarios such as PHP wanting to print a JPG. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of David Seruyange Sent: Thursday, April 17, 2008 10:59 AM To: IronPython IronPython Subject: [IronPython] Redirecting input/output in IronPython 2.x Hey everyone, looking at a lot of the samples online I see the following: pythonEngine.SetStandardError(s); pythonEngine.SetStandardOutput(s); where s is some stream. The Python Engine doesn't seem to support that method when I make a reference to IronPython 2.0. Am I missing something or are the online resources now obsolete? Thanks much - David ________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. -------------- next part -------------- An HTML attachment was scrubbed... URL: From acarter at teamdataforce.com Thu Apr 17 22:22:34 2008 From: acarter at teamdataforce.com (Adam Carter) Date: Thu, 17 Apr 2008 13:22:34 -0700 Subject: [IronPython] Learning IronPython In-Reply-To: References: Message-ID: <002401c8a0c8$c64652e0$52d2f8a0$@com> Michael, When did chapter 9 come out? I haven't gotten a notification from MEAP. --Adam Message: 4 Date: Wed, 16 Apr 2008 20:40:03 +0100 From: Michael Foord Subject: Re: [IronPython] Learning IronPython To: Discussion of IronPython Message-ID: <48065613.6050001 at voidspace.org.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Tarun Kapoor wrote: > Michael - do you have a date on when you book is coming out ? > Hopefully July / August. There is already early access to the first 9 chapters (with more coming soon) via the early access program. Michael http://www.ironpythoninaction.com/ From fuzzyman at voidspace.org.uk Fri Apr 18 00:58:52 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 17 Apr 2008 23:58:52 +0100 Subject: [IronPython] Learning IronPython In-Reply-To: <002401c8a0c8$c64652e0$52d2f8a0$@com> References: <002401c8a0c8$c64652e0$52d2f8a0$@com> Message-ID: <4807D62C.6070808@voidspace.org.uk> Adam Carter wrote: > Michael, > > When did chapter 9 come out? I haven't gotten a notification from MEAP. > Rats. Chapter nine is written (as is chapter eleven) - they *aren't* available yet, but they *should* be. I'll ping Manning about it. My apologies. I think the latest MEAP release goes up to chapter 8. Michael > --Adam > > > Message: 4 > Date: Wed, 16 Apr 2008 20:40:03 +0100 > From: Michael Foord > Subject: Re: [IronPython] Learning IronPython > To: Discussion of IronPython > Message-ID: <48065613.6050001 at voidspace.org.uk> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Tarun Kapoor wrote: > >> Michael - do you have a date on when you book is coming out ? >> >> > Hopefully July / August. There is already early access to the first 9 > chapters (with more coming soon) via the early access program. > > Michael > http://www.ironpythoninaction.com/ > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From idmkid at yahoo.com Fri Apr 18 05:33:20 2008 From: idmkid at yahoo.com (David Seruyange) Date: Thu, 17 Apr 2008 20:33:20 -0700 (PDT) Subject: [IronPython] DLR Hosting, Access to .NET Types Message-ID: <977212.56833.qm@web30808.mail.mud.yahoo.com> Hello, thanks much to Dino on my last message. After redirecting output and error, I now see the error I was getting explained a little more in depth. I'm executing a script in order to load it as a module. The code is something like this: string p = Path.Combine("path to script"); ScriptScope newScope = engine.Runtime.ExecuteFile(p); Are all framework types accessible from a hosted engine? While the module loads fine using the above code, a reference to the StringBuilder (which works fine when executing a file that references the module) produces an error "name StringBuilder not defined." (The module does have a "from System.Text import *") - Thanks and regards, David ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Fri Apr 18 05:39:49 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 17 Apr 2008 20:39:49 -0700 Subject: [IronPython] DLR Hosting, Access to .NET Types In-Reply-To: <977212.56833.qm@web30808.mail.mud.yahoo.com> References: <977212.56833.qm@web30808.mail.mud.yahoo.com> Message-ID: On Thu, Apr 17, 2008 at 8:33 PM, David Seruyange wrote: > > Are all framework types accessible from a hosted engine? While the module > loads fine using the above code, a reference to the StringBuilder (which > works fine when executing a file that references the module) produces an > error "name StringBuilder not defined." (The module does have a "from > System.Text import *") - The console does the equivalent of the following: runtime.LoadAssembly(typeof(string).Assembly); runtime.LoadAssembly(typeof(System.Diagnostics.Debug).Assembly); You'll need to execute similar code if you want to access the same assemblies -- Curt Hagenlocher curt at hagenlocher.org From idmkid at yahoo.com Fri Apr 18 06:28:28 2008 From: idmkid at yahoo.com (David Seruyange) Date: Thu, 17 Apr 2008 21:28:28 -0700 (PDT) Subject: [IronPython] DLR Hosting, Access to .NET Types Message-ID: <782237.27668.qm@web30807.mail.mud.yahoo.com> I think I follow you but I think I can be more specific in getting at what sems to be a subtlety. If you have the following (a file e.g. Spam.py): import clr clr.AddReference("System") from System.Text import * s = StringBuilder() print "okay" It works just fine when executed from a command shell using ipy (ipy Spam.py). The assumption is that mscorlib is loaded because of the clr.AddReference("System"). But when using a hosted engine, mscorlib seems not to be loaded for free anymore - ScriptEngine engine = PythonEngine.CurrentEngine; engine.Runtime.ExecuteFile("Spam.py") Now the reference that came for "free" before to mscorlib seems not to be present. ----- Original Message ---- From: Curt Hagenlocher To: Discussion of IronPython Sent: Thursday, April 17, 2008 10:39:49 PM Subject: Re: [IronPython] DLR Hosting, Access to .NET Types On Thu, Apr 17, 2008 at 8:33 PM, David Seruyange wrote: > > Are all framework types accessible from a hosted engine? While the module > loads fine using the above code, a reference to the StringBuilder (which > works fine when executing a file that references the module) produces an > error "name StringBuilder not defined." (The module does have a "from > System.Text import *") - The console does the equivalent of the following: runtime.LoadAssembly(typeof(string).Assembly); runtime.LoadAssembly(typeof(System.Diagnostics.Debug).Assembly); You'll need to execute similar code if you want to access the same assemblies -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Fri Apr 18 06:33:29 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 17 Apr 2008 21:33:29 -0700 Subject: [IronPython] DLR Hosting, Access to .NET Types In-Reply-To: <782237.27668.qm@web30807.mail.mud.yahoo.com> References: <782237.27668.qm@web30807.mail.mud.yahoo.com> Message-ID: On Thu, Apr 17, 2008 at 9:28 PM, David Seruyange wrote: > > But when using a hosted engine, mscorlib seems not to be loaded for free > anymore - That is correct, and represents a change that was made around 2.0 Alpha 8 (if I remember correctly). That's why you need to explicitly add assembly references to the runtime. -- Curt Hagenlocher curt at hagenlocher.org From idmkid at yahoo.com Fri Apr 18 07:00:32 2008 From: idmkid at yahoo.com (David Seruyange) Date: Thu, 17 Apr 2008 22:00:32 -0700 (PDT) Subject: [IronPython] DLR Hosting, Access to .NET Types Message-ID: <635246.61460.qm@web30802.mail.mud.yahoo.com> Thank you for your help! I did the following which seems to work quite fine: Assembly assem = Assembly.GetAssembly(Type.GetType("System.Text.StringBuilder")); engine.Runtime.LoadAssembly(assem); Of course if it's a change as of 2.0 I wonder why it doesn't manifest itself when executing from the command shell. Unless (and I take your meaning as such) it's the DLR Hosting libraries as of 2.0 - Only midnight, glad you bailed me out Curt otherwise I may have been a sleepy fellow tomorrow at work. :^) David ----- Original Message ---- From: Curt Hagenlocher To: Discussion of IronPython Sent: Thursday, April 17, 2008 11:33:29 PM Subject: Re: [IronPython] DLR Hosting, Access to .NET Types On Thu, Apr 17, 2008 at 9:28 PM, David Seruyange wrote: > > But when using a hosted engine, mscorlib seems not to be loaded for free > anymore - That is correct, and represents a change that was made around 2.0 Alpha 8 (if I remember correctly). That's why you need to explicitly add assembly references to the runtime. -- Curt Hagenlocher curt at hagenlocher.org _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Fri Apr 18 07:06:29 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Thu, 17 Apr 2008 22:06:29 -0700 Subject: [IronPython] DLR Hosting, Access to .NET Types In-Reply-To: <635246.61460.qm@web30802.mail.mud.yahoo.com> References: <635246.61460.qm@web30802.mail.mud.yahoo.com> Message-ID: On Thu, Apr 17, 2008 at 10:00 PM, David Seruyange wrote: > > Of course if it's a change as of 2.0 I wonder why it doesn't manifest itself > when executing from the command shell. It doesn't manifest from the shell because this code is now part of the PythonCommandLine class, which is used by the shell but is not executed when using the hosting interface. Glad to help! -- Curt Hagenlocher curt at hagenlocher.org From d.moor at sim-soft.co.uk Fri Apr 18 11:00:42 2008 From: d.moor at sim-soft.co.uk (Dave Moor) Date: Fri, 18 Apr 2008 10:00:42 +0100 Subject: [IronPython] IP as a Macro Language Message-ID: <4808633A.5010009@sim-soft.co.uk> Hi I am trying to use IronPython as a macro language in out C# modelling application. I'm currently using VS2005 and .Net2 for the main application and using IronPython 1.1 as the macro engine. My problem is, I can create a form entirely in IP but I can't seem to get it added as a MDIChild to the main application, and when the form is closed the form's timer is still running in the background requesting data from the main application. My first attempt at solving this was to create a host form on the C# side (including the timer) an load a panel written in IP, this worked (loaded and drew the form) but the panel does not seem to respond to update requests from the C# form. I gather from this list that IP has problems destroying C# objects it has instantiated and I assume that it has problems responding to events triggered from the CLR side. Will the above problems be eased/fixed in version 2 or am I as well persevering with version 1.1 for the time being? I'd appreciate an advice you can offer me. -- *David Moor* Senior Engineer Simulation Software Limited *Phone:* +44 (0)113 2819038 *Fax:* +44 (0)113 2590863 *Email:* D.Moor at sim-soft.co.uk _www.ssl-int.com _ CONFIDENTIALITY NOTICE This email transmission is confidential, may be privileged and should be read or retained only by the intended recipient. If you have received this transmission in error, please immediately notify the sender and delete it from your system. -- Registered Office Mill House, Hawksworth Road, Horsforth, Leeds, LS18 4JP England. Reg No. 1311728 Eng. From fuzzyman at voidspace.org.uk Fri Apr 18 15:39:10 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 18 Apr 2008 14:39:10 +0100 Subject: [IronPython] Using and IronPython 1.1 Dictionary from C# Message-ID: <4808A47E.10706@voidspace.org.uk> Hello all, I'm trying to use an IronPython (1.1) dictionary from C#, where the dictionary is keyed by tuples. I am printing the keys - so I can see that the values I want are in the dictionary, but I can't fetch them. I have tried various approaches - the problem seems to be that when I create a new Tuple from two integers it isn't recognised as a valid key. Any suggestions/corrections. Code below (range is a Python 'Dict'): System.Console.WriteLine("Keys: {0}", range.keys()); for (int row = minRow; row < (maxRow + 1); row++) { for (int col = minCol; col < (maxCol+1); col++) { Tuple key = new Tuple(new object[col, row]); object val = range.GetValue(key); if (val != null) { try { result = (Double)FloatOps.Add(result, val); } catch (Exception e) { System.Console.WriteLine(e); } } else { System.Console.WriteLine("No Value for col {0} row {1}", col, row); } } I'm aware that the cast there is 'dubious', but as my code never reaches it it hasn't been a problem so far! Michael Foord From simon.dahlbacka at gmail.com Fri Apr 18 16:16:26 2008 From: simon.dahlbacka at gmail.com (Simon Dahlbacka) Date: Fri, 18 Apr 2008 17:16:26 +0300 Subject: [IronPython] Using and IronPython 1.1 Dictionary from C# In-Reply-To: <4808A47E.10706@voidspace.org.uk> References: <4808A47E.10706@voidspace.org.uk> Message-ID: <57124720804180716o21613c93u9c51f8f973bf8384@mail.gmail.com> Actually, I don't really have a clue about this but Tuple key = new Tuple(new object[col, row]); seems like it doesn't do what it probably should do, or do you intend to pass a multidimensional array to the Tuple constructor? /Simon On Fri, Apr 18, 2008 at 4:39 PM, Michael Foord wrote: > Hello all, > > I'm trying to use an IronPython (1.1) dictionary from C#, where the > dictionary is keyed by tuples. > > I am printing the keys - so I can see that the values I want are in the > dictionary, but I can't fetch them. I have tried various approaches - > the problem seems to be that when I create a new Tuple from two integers > it isn't recognised as a valid key. Any suggestions/corrections. > > Code below (range is a Python 'Dict'): > > > System.Console.WriteLine("Keys: {0}", range.keys()); > for (int row = minRow; row < (maxRow + 1); row++) > { > for (int col = minCol; col < (maxCol+1); col++) > { > Tuple key = new Tuple(new object[col, row]); > object val = range.GetValue(key); > if (val != null) > { > try > { > result = (Double)FloatOps.Add(result, val); > } > catch (Exception e) > { > System.Console.WriteLine(e); > } > } > else > { > System.Console.WriteLine("No Value for col > {0} row {1}", col, row); > } > } > > I'm aware that the cast there is 'dubious', but as my code never reaches > it it hasn't been a problem so far! > > Michael Foord > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuzzyman at voidspace.org.uk Fri Apr 18 16:20:52 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 18 Apr 2008 15:20:52 +0100 Subject: [IronPython] Using and IronPython 1.1 Dictionary from C# In-Reply-To: <57124720804180716o21613c93u9c51f8f973bf8384@mail.gmail.com> References: <4808A47E.10706@voidspace.org.uk> <57124720804180716o21613c93u9c51f8f973bf8384@mail.gmail.com> Message-ID: <4808AE44.9040405@voidspace.org.uk> Simon Dahlbacka wrote: > Actually, I don't really have a clue about this but > > Tuple key = new Tuple(new object[col, row]); > > seems like it doesn't do what it probably should do, or do you intend > to pass a multidimensional array to the Tuple constructor? :-) That is probably it. Thanks Michael > > /Simon > > On Fri, Apr 18, 2008 at 4:39 PM, Michael Foord > > wrote: > > Hello all, > > I'm trying to use an IronPython (1.1) dictionary from C#, where the > dictionary is keyed by tuples. > > I am printing the keys - so I can see that the values I want are > in the > dictionary, but I can't fetch them. I have tried various approaches - > the problem seems to be that when I create a new Tuple from two > integers > it isn't recognised as a valid key. Any suggestions/corrections. > > Code below (range is a Python 'Dict'): > > > System.Console.WriteLine("Keys: {0}", range.keys()); > for (int row = minRow; row < (maxRow + 1); row++) > { > for (int col = minCol; col < (maxCol+1); col++) > { > Tuple key = new Tuple(new object[col, row]); > object val = range.GetValue(key); > if (val != null) > { > try > { > result = > (Double)FloatOps.Add(result, val); > } > catch (Exception e) > { > System.Console.WriteLine(e); > } > } > else > { > System.Console.WriteLine("No Value for col > {0} row {1}", col, row); > } > } > > I'm aware that the cast there is 'dubious', but as my code never > reaches > it it hasn't been a problem so far! > > Michael Foord > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From fuzzyman at voidspace.org.uk Fri Apr 18 16:29:18 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 18 Apr 2008 15:29:18 +0100 Subject: [IronPython] Using and IronPython 1.1 Dictionary from C# In-Reply-To: <4808AE44.9040405@voidspace.org.uk> References: <4808A47E.10706@voidspace.org.uk> <57124720804180716o21613c93u9c51f8f973bf8384@mail.gmail.com> <4808AE44.9040405@voidspace.org.uk> Message-ID: <4808B03E.8070709@voidspace.org.uk> Michael Foord wrote: > Simon Dahlbacka wrote: > >> Actually, I don't really have a clue about this but >> >> Tuple key = new Tuple(new object[col, row]); >> >> seems like it doesn't do what it probably should do, or do you intend >> to pass a multidimensional array to the Tuple constructor? >> > :-) > > That is probably it. > What I meant of course was: new Tuple(new object[2] {col, row}) Which, all in all, is marginally slower than the pure Python solution... :-) Michael > Thanks > > Michael > > >> /Simon >> >> On Fri, Apr 18, 2008 at 4:39 PM, Michael Foord >> > wrote: >> >> Hello all, >> >> I'm trying to use an IronPython (1.1) dictionary from C#, where the >> dictionary is keyed by tuples. >> >> I am printing the keys - so I can see that the values I want are >> in the >> dictionary, but I can't fetch them. I have tried various approaches - >> the problem seems to be that when I create a new Tuple from two >> integers >> it isn't recognised as a valid key. Any suggestions/corrections. >> >> Code below (range is a Python 'Dict'): >> >> >> System.Console.WriteLine("Keys: {0}", range.keys()); >> for (int row = minRow; row < (maxRow + 1); row++) >> { >> for (int col = minCol; col < (maxCol+1); col++) >> { >> Tuple key = new Tuple(new object[col, row]); >> object val = range.GetValue(key); >> if (val != null) >> { >> try >> { >> result = >> (Double)FloatOps.Add(result, val); >> } >> catch (Exception e) >> { >> System.Console.WriteLine(e); >> } >> } >> else >> { >> System.Console.WriteLine("No Value for col >> {0} row {1}", col, row); >> } >> } >> >> I'm aware that the cast there is 'dubious', but as my code never >> reaches >> it it hasn't been a problem so far! >> >> Michael Foord >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From curt at hagenlocher.org Fri Apr 18 16:48:52 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 18 Apr 2008 07:48:52 -0700 Subject: [IronPython] IP as a Macro Language In-Reply-To: <4808633A.5010009@sim-soft.co.uk> References: <4808633A.5010009@sim-soft.co.uk> Message-ID: On Fri, Apr 18, 2008 at 2:00 AM, Dave Moor wrote: > > My problem is, I can create a form entirely in IP but I can't seem to > get it added as a MDIChild to the main application, and when the form is > closed the form's timer is still running in the background requesting > data from the main application. For the most part, anything you can do along these lines from C# can also be done from within IronPython. Can you provide a snippet of Python code that shows the approach that wasn't working for you? > I gather from this list that IP has problems destroying C# objects it > has instantiated and I assume that it has problems responding to events > triggered from the CLR side. Both IronPython and C# rely on the same underlying CLR garbage collector, so there really shouldn't be any difference in this regard. Could you be storing a reference to the form from Python code which would prevent garbage collection? For instance, if you assign the form to a module-level variable, it will probably never be destroyed because the module itself is kept alive by a reference from sys.modules. -- Curt Hagenlocher curt at hagenlocher.org From fuzzyman at voidspace.org.uk Fri Apr 18 17:20:52 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 18 Apr 2008 16:20:52 +0100 Subject: [IronPython] IP as a Macro Language In-Reply-To: References: <4808633A.5010009@sim-soft.co.uk> Message-ID: <4808BC54.9070701@voidspace.org.uk> Curt Hagenlocher wrote: > On Fri, Apr 18, 2008 at 2:00 AM, Dave Moor wrote: > >> My problem is, I can create a form entirely in IP but I can't seem to >> get it added as a MDIChild to the main application, and when the form is >> closed the form's timer is still running in the background requesting >> data from the main application. >> > > For the most part, anything you can do along these lines from C# can > also be done from within IronPython. Can you provide a snippet of > Python code that shows the approach that wasn't working for you? > > >> I gather from this list that IP has problems destroying C# objects it >> has instantiated and I assume that it has problems responding to events >> triggered from the CLR side. >> > > Both IronPython and C# rely on the same underlying CLR garbage > collector, so there really shouldn't be any difference in this regard. > Could you be storing a reference to the form from Python code which > would prevent garbage collection? For instance, if you assign the > form to a module-level variable, it will probably never be destroyed > because the module itself is kept alive by a reference from > sys.modules. > We also had an issue where adding python functions/methods as event handlers would keep forms alive as IronPython stores a mapping of handler functions to delegates. Explicitly unsubscribing to events on disposal solved that problem - but it was a lot of work. Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Fri Apr 18 18:22:07 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 18 Apr 2008 09:22:07 -0700 Subject: [IronPython] IP as a Macro Language In-Reply-To: <4808BC54.9070701@voidspace.org.uk> References: <4808633A.5010009@sim-soft.co.uk> <4808BC54.9070701@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C22270124ED7FFA68@DF-GRTDANE-MSG.exchange.corp.microsoft.com> FYI that bug should be fixed in 2.0. We now use weak references on both the handler and the target so we don't keep things alive. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, April 18, 2008 8:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IP as a Macro Language Curt Hagenlocher wrote: > On Fri, Apr 18, 2008 at 2:00 AM, Dave Moor wrote: > >> My problem is, I can create a form entirely in IP but I can't seem to >> get it added as a MDIChild to the main application, and when the form is >> closed the form's timer is still running in the background requesting >> data from the main application. >> > > For the most part, anything you can do along these lines from C# can > also be done from within IronPython. Can you provide a snippet of > Python code that shows the approach that wasn't working for you? > > >> I gather from this list that IP has problems destroying C# objects it >> has instantiated and I assume that it has problems responding to events >> triggered from the CLR side. >> > > Both IronPython and C# rely on the same underlying CLR garbage > collector, so there really shouldn't be any difference in this regard. > Could you be storing a reference to the form from Python code which > would prevent garbage collection? For instance, if you assign the > form to a module-level variable, it will probably never be destroyed > because the module itself is kept alive by a reference from > sys.modules. > We also had an issue where adding python functions/methods as event handlers would keep forms alive as IronPython stores a mapping of handler functions to delegates. Explicitly unsubscribing to events on disposal solved that problem - but it was a lot of work. Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From curt at hagenlocher.org Fri Apr 18 18:23:15 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 18 Apr 2008 09:23:15 -0700 Subject: [IronPython] IP as a Macro Language In-Reply-To: <7AD436E4270DD54A94238001769C22270124ED7FFA68@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <4808633A.5010009@sim-soft.co.uk> <4808BC54.9070701@voidspace.org.uk> <7AD436E4270DD54A94238001769C22270124ED7FFA68@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: Sounds like a possible candidate for 1.1.2? :) On Fri, Apr 18, 2008 at 9:22 AM, Dino Viehland wrote: > FYI that bug should be fixed in 2.0. We now use weak references on both > the handler and the target so we don't keep things alive. > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, April 18, 2008 8:21 AM > To: Discussion of IronPython > Subject: Re: [IronPython] IP as a Macro Language > > Curt Hagenlocher wrote: > > On Fri, Apr 18, 2008 at 2:00 AM, Dave Moor > wrote: > > > >> My problem is, I can create a form entirely in IP but I can't seem to > >> get it added as a MDIChild to the main application, and when the form > is > >> closed the form's timer is still running in the background requesting > >> data from the main application. > >> > > > > For the most part, anything you can do along these lines from C# can > > also be done from within IronPython. Can you provide a snippet of > > Python code that shows the approach that wasn't working for you? > > > > > >> I gather from this list that IP has problems destroying C# objects it > >> has instantiated and I assume that it has problems responding to events > >> triggered from the CLR side. > >> > > > > Both IronPython and C# rely on the same underlying CLR garbage > > collector, so there really shouldn't be any difference in this regard. > > Could you be storing a reference to the form from Python code which > > would prevent garbage collection? For instance, if you assign the > > form to a module-level variable, it will probably never be destroyed > > because the module itself is kept alive by a reference from > > sys.modules. > > > We also had an issue where adding python functions/methods as event > handlers would keep forms alive as IronPython stores a mapping of > handler functions to delegates. > > Explicitly unsubscribing to events on disposal solved that problem - but > it was a lot of work. > > Michael > > > -- > > Curt Hagenlocher > > curt at hagenlocher.org > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Fri Apr 18 18:25:53 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 18 Apr 2008 09:25:53 -0700 Subject: [IronPython] IP as a Macro Language In-Reply-To: References: <4808633A.5010009@sim-soft.co.uk> <4808BC54.9070701@voidspace.org.uk> <7AD436E4270DD54A94238001769C22270124ED7FFA68@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <7AD436E4270DD54A94238001769C22270124ED7FFA6E@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Yep, it probably is. It was actually a pretty non-invasive change and I don't think that code has changed much between 1.x and 2.0. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher Sent: Friday, April 18, 2008 9:23 AM To: Discussion of IronPython Subject: Re: [IronPython] IP as a Macro Language Sounds like a possible candidate for 1.1.2? :) On Fri, Apr 18, 2008 at 9:22 AM, Dino Viehland > wrote: FYI that bug should be fixed in 2.0. We now use weak references on both the handler and the target so we don't keep things alive. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, April 18, 2008 8:21 AM To: Discussion of IronPython Subject: Re: [IronPython] IP as a Macro Language Curt Hagenlocher wrote: > On Fri, Apr 18, 2008 at 2:00 AM, Dave Moor > wrote: > >> My problem is, I can create a form entirely in IP but I can't seem to >> get it added as a MDIChild to the main application, and when the form is >> closed the form's timer is still running in the background requesting >> data from the main application. >> > > For the most part, anything you can do along these lines from C# can > also be done from within IronPython. Can you provide a snippet of > Python code that shows the approach that wasn't working for you? > > >> I gather from this list that IP has problems destroying C# objects it >> has instantiated and I assume that it has problems responding to events >> triggered from the CLR side. >> > > Both IronPython and C# rely on the same underlying CLR garbage > collector, so there really shouldn't be any difference in this regard. > Could you be storing a reference to the form from Python code which > would prevent garbage collection? For instance, if you assign the > form to a module-level variable, it will probably never be destroyed > because the module itself is kept alive by a reference from > sys.modules. > We also had an issue where adding python functions/methods as event handlers would keep forms alive as IronPython stores a mapping of handler functions to delegates. Explicitly unsubscribing to events on disposal solved that problem - but it was a lot of work. Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From sakesun at boonthavorn.com Sat Apr 19 13:38:56 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Sat, 19 Apr 2008 18:38:56 +0700 Subject: [IronPython] Need help to port dynamic class generation code to IP2 Message-ID: Hi, I've been using IP1 with System.Reflection to generate some class dynamically, because my class need to be attached by some [Attribute] here is my code to build a new class with System.Reflection.Emit def make_service(cls, servicename, invoker=None, factoryname=None, factoryproperties=None): # // use System.Reflection.Emit to make a class # // C# # using IronPython.Runtime; # using IronPython.Runtime.Types; # [Service(Name=<>, InvokerClass=<>)] # [<>(**factoryproperties)] # class <>: <> # { # public static UserType pyType; # public <>(): base(pyType) # { # pyType.InvokeSpecialMethod(this, SymbolTable.Init, new object[0]); # } # } global _module from IronPython.Runtime.Types import DynamicType, UserType dynamictype = clr.GetClrType(DynamicType) usertype = clr.GetClrType(UserType) base = clr.GetClrType(cls) t_attrs = type_attrs('Public', 'Class', 'AutoClass', 'AnsiClass', 'BeforeFieldInit', 'AutoLayout') t = _module.DefineType(servicename, t_attrs, base) pyType = t.DefineField('pyType', clr.GetClrType(UserType), field_attrs('Public', 'Static')) base_ctor = base.GetConstructor(TypeArray([usertype])) from IronPython.Runtime import SymbolId, SymbolTable __init__ = clr.GetClrType(SymbolTable).GetField('Init') InvokeSpecialMethod = dynamictype.GetMethod('InvokeSpecialMethod', TypeArray([dotnet.Object, SymbolId, ObjectArray])) GetDynamicType = dynamictype.GetMethod('GetDynamicType') ctor = t.DefineConstructor(method_attrs('Public', 'HideBySig'), Reflection.CallingConventions.Standard, TypeArray([])) g = ctor.GetILGenerator() from System.Reflection.Emit.OpCodes import Ldarg_0, Ldsfld, Call, Ldc_I4_0, Newarr, Callvirt, Pop, Ret g.Emit(Ldarg_0) g.Emit(Ldsfld, pyType) g.Emit(Call, base_ctor) g.Emit(Ldsfld, pyType) g.Emit(Ldarg_0) g.Emit(Ldsfld, __init__) g.Emit(Ldc_I4_0) g.Emit(Newarr, clr.GetClrType(dotnet.Object)) g.Emit(Callvirt, InvokeSpecialMethod) g.Emit(Pop) g.Emit(Ret) if invoker is None: invoker = get_invoker_from_clrtype(base.BaseType) t.SetCustomAttribute(ServiceAttributeBuilder(servicename, invoker)) if factoryname: t.SetCustomAttribute(FactoryAttributeBuilder(factoryname, factoryproperties)) service = clr.GetPythonType(t.CreateType()) service.pyType = cls return service Recently I try IP2 and found some class are missing from my understand "IronPython.Runtime.Types.DynamicType" is now become "IronPython.Runtime.Types.PythonType" "IronPython.Runtime.Types.UserType" is now become "IronPython.Runtime.Types.ExtensibleType" "IronPython.Runtime.SymbolId" is now become "IronPython.Runtime.Types.PythonType" "IronPython.Runtime.SymbolId" is now become "Microsoft.Scripting.SymbolId" "IronPython.Runtime.SymbolTable" is now become "Microsoft.Scripting.SymbolTable" Am I right ? However simply swapping the class is not working. Can anybody guide me what changed in class-mechanism from IP1 to IP2? Or better, does IP2 now support attaching class attribute ? thanks. From ronnie.maor at gmail.com Sat Apr 19 13:39:51 2008 From: ronnie.maor at gmail.com (Ronnie Maor) Date: Sat, 19 Apr 2008 14:39:51 +0300 Subject: [IronPython] Updates for 1.1.2 In-Reply-To: <7AD436E4270DD54A94238001769C22270124ED7FF7A4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <48072CEB.7040303@voidspace.org.uk> <48073BE7.9080407@voidspace.org.uk> <7AD436E4270DD54A94238001769C22270124ED7FF7A4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <2fd6b9d0804190439m39a3caeep86cadb18f32a83d4@mail.gmail.com> how about this one? seems like a trivial fix: (I'm including my original post. don't know if there's an open bug for this) with the following C# class: public class A { public A(int? i, string s1, string s2, string s3, string s4, string s5) { } } the following python code: A(None, 'a', 'a', 'a', 'a', 'a') fails with: TypeError: expected Nullable[int], got NoneType Reducing the number of parameters to A (removing s5) makes the problem go away... In IPy 2.0a5 this specific case works, so the problem might be fixed there. On Thu, Apr 17, 2008 at 6:44 PM, Dino Viehland wrote: > This is a great list, thanks! Anyone else? > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Thursday, April 17, 2008 5:01 AM > To: Discussion of IronPython > Subject: Re: [IronPython] Updates for 1.1.2 > > More candidates. > > These have affected us at Resolver: > > #10983 Reading files in text mode reads chars > 0x7F as '?' > SyntaxError doesnt get lineno (or other properties) when created by user > code > #14882 Trivial: Implement float.__lt__(float) (and friends...) > #10709 Using lambda in class definition will add into the > class's dictionary > #11133 Implicit conversion operators not supported > #7011 Caching of generated IL to disk for packages > > These look like good ones to backport as well: > > #11487 __str__ does not call __repr__ in new style classes > #10291 calling base class __call__ invokes constructor instead > #2443 problem with __slots__ and __init__ in new-style classes > #11812 dir(bool), dir(True), dir(False) raise SystemError on startup > #1402 try-finally has an issue in generator > #10580 "type in (None,)" throws a SystemError > #8361 Trivial: popen shouldn't open new window > #2704 __import__ and packages aren't mixing well > #8780 Removes the inexistent file did not throw OSError in IP > #8297 range w/ large negative number produces incorrect results > #9351 int() doesn't convert representable longs to int > #3117 dict.update doesn't take keyword arguments - differs from CPython > #4197 Trivial: int('0x20', 16) fails to parse, long too > #4322 unpacking single element tuples in for-statement, listcomp and > generator > #5447 socket.getnameinfo(...) broken under Vista > #5083 operator.__contains__ is broken > #13686 Using setattr with modules > #13651 importing package with imp module > #5801 Class with slots and getattr not compatible > #14861 Value types don't work when a function is called twice > > I hope that gives you enough to work on... > > Michael > > Michael Foord wrote: > > Hello all, > > > > Off the top of my head the only bugfixes I can *remember* that I would > > like to see in 1.1.2 are: > > > > * Compiled regular expression perf fix > > * Further socket fixes > > * Tuple hashing improvement > > * PyCF_DONT_IMPLY_DEDENT (or whatever it was) support in compile > > * Array objects don't have methods when clr not imported (I don't > > *think* this was addressed in 1.1.1 but may be wrong) > > > > I'll try and look through and see if I can spot some more. > > > > Michael > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sakesun at boonthavorn.com Sun Apr 20 15:13:20 2008 From: sakesun at boonthavorn.com (=?utf-8?B?IOC5gOC4quC4geC4quC4o+C4o+C4hOC5jA==?=) Date: Sun, 20 Apr 2008 20:13:20 +0700 Subject: [IronPython] Need help to port-dynamic class generation code to IP2 Message-ID: <1326.1208697200@boonthavorn.com> Hi, Unless I simplify my question, I believe there will be a very little chance I will get some help. So, here is my renewed question. I'm now using IronPython to implement service components in an application framework (RemObjects DataAbstract, if that matter) The framework require that any service component must meet these requirement 1. Extend from their base class. 2. Its constructor cannot contains any arguments The framework use Attribute that attached to the base class they provided to discover all available services and then instantiate it via the default constructor Since IronPython can extend any .NET base class seamlessly, the #1 requirement is not an issue. However, the generated IronPython sub-class will always equipped with constructor with one argument that link the static class to its dynamic type. Here come the trouble. Motivated by my intensive dynamic language preference, I struggle with System.Reflection and IronPython source code and came up with a solution to subclass any python type to a new class that meet the #2 requirement. The solution is simply use System.Reflection to emit the clase like this // C# class : { public static pyType; // dynamictype is UserType or PythonType public (): base(pyType) // call base constructor with pyType as argument { } } Of course, the "pyType" static field will have to be set to its base-classd dynamic type prior to it's usage. (Note that "__init__" won't be called with this approach.) This solution work fine for IronPython 1.1 and allow me to keep my development progress until recently that I start exploring IronPython 2.0 (due to memory leak problem in 1.1) Porting from 1.0 to 2.0 require changing UserType to PythonType instead. After change, the code can emit valid class without error but the class cause the system to halt. I'm not sure whether my working approach in 1.1 is just a obscure trick that should never be rely on, or is it just a bug in 2.0. Hope I can find the answer here. Thanks in advance Here is the complete code to demonstrate the problem: ### demo.py ### import clr clr.AddReference('IronPython') clr.AddReference('System.Data') from System.Data import DataTable from System import Array, Type, Reflection TypeArray = Array[Type] # initialize global constants & variables ASSEMBLY_NAME = 'MyDynamicAssembly' MODULE_NAME = 'DynamicModule' from System import AppDomain _domain = AppDomain.CurrentDomain _assemblyname = Reflection.AssemblyName() _assemblyname.Name = ASSEMBLY_NAME _assembly = _domain.DefineDynamicAssembly(_assemblyname, Reflection.Emit.AssemblyBuilderAccess.Run) _module = _assembly.DefineDynamicModule(MODULE_NAME) # I'm usinge DataTable as an example of the class that need to be extended class PyDataTable(DataTable): def show(self): print 'Extended !' def define_type(module, name, base): attrs = Reflection.TypeAttributes.Public | Reflection.TypeAttributes.Class | Reflection.TypeAttributes.AutoClass | Reflection.TypeAttributes.AnsiClass | Reflection.TypeAttributes.BeforeFieldInit | Reflection.TypeAttributes.AutoLayout return module.DefineType(name, attrs, base) def define_field(t, name, typ): attrs = Reflection.FieldAttributes.Public | Reflection.FieldAttributes.Static return t.DefineField(name, typ, attrs) def define_constructor(t): attrs = Reflection.MethodAttributes.Public | Reflection.MethodAttributes.HideBySig return t.DefineConstructor(attrs, Reflection.CallingConventions.Standard, TypeArray([])) def common_wrap(BaseClass, name, dynamictype): # // use System.Reflection.Emit to make a class # // C# # class : # { # public static pyType; // reference to UserType or PythonType # public (): base(pyType) // call base constructor with pyType as argument # { # } # } global _module from IronPython.Runtime import Types dytype = clr.GetClrType(dynamictype) base = clr.GetClrType(BaseClass) t = define_type(_module, name, base) pyType = define_field(t, 'pyType', dytype) base_ctor = base.GetConstructor(TypeArray([dytype])) ctor = define_constructor(t) g = ctor.GetILGenerator() from System.Reflection.Emit.OpCodes import Ldarg_0, Ldsfld, Call, Ret g.Emit(Ldarg_0) g.Emit(Ldsfld, pyType) g.Emit(Call, base_ctor) g.Emit(Ret) r = clr.GetPythonType(t.CreateType()) r.pyType = BaseClass return r def wrap_1(BaseClass, name): from IronPython.Runtime import Types return common_wrap(BaseClass, name, Types.UserType) def wrap_2(BaseClass, name): from IronPython.Runtime import Types return common_wrap(BaseClass, name, Types.PythonType) def wrap(BaseClass, name): import sys if 'IronPython 2.0' in sys.version: return wrap_2(BaseClass, name) else: return wrap_1(BaseClass, name) WrappedPyDataTable = wrap(PyDataTable, 'WrappedPyDataTable') w = WrappedPyDataTable() print 'in 2.0 any action perform to "w" will cause system to halt' w.show() ------------------------- Msg sent via @Mail Softnix Messaging Server http://www.softnix.co.th -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ask_for_help.py Type: application/octet-stream Size: 3218 bytes Desc: not available URL: From curt at hagenlocher.org Sun Apr 20 22:01:29 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 20 Apr 2008 13:01:29 -0700 Subject: [IronPython] Need help to port-dynamic class generation code to IP2 In-Reply-To: <1326.1208697200@boonthavorn.com> References: <1326.1208697200@boonthavorn.com> Message-ID: On Sun, Apr 20, 2008 at 6:13 AM, ???????? wrote: > > print 'in 2.0 any action perform to "w" will cause system to halt' > w.show() Evaluation gets stuck in an infinite loop in ActionBinder.UpdateSiteAndExecute. The fact that __init__ isn't called is pretty strong evidence that part of the initialization process is being skipped when you call the constructor directly. In the case of IronPython 1.x, this is apparently not fatal -- but not so IP 2.0. The normal construction process for a new object is triggered by a __call__ to the type object. In 2.0, this gets handled by the method PythonCallBinderHelper.MakePythonTypeCallRule, which generates the DLR expression tree that will actually implement the construction. It doesn't look like it would look very easy to hook into this object creation process. I take it that you need to provide the library with a Type object? -- Curt Hagenlocher curt at hagenlocher.org From sakesun at boonthavorn.com Mon Apr 21 03:21:45 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Mon, 21 Apr 2008 08:21:45 +0700 Subject: [IronPython] Need help to port-dynamic class generation code to IP2 In-Reply-To: References: <1326.1208697200@boonthavorn.com> Message-ID: Real thanks for your time and effort. > The fact that __init__ isn't called is pretty strong evidence that > part of the initialization process is being skipped when you call the > constructor directly. In the case of IronPython 1.x, this is > apparently not fatal -- but not so IP 2.0. In my actual implementation, I do call __init__ within the emitted class by calling "InvokeSpecialMethod" inside the generated constructor. Unfortunately, the method is no longer available in 2.0 > > The normal construction process for a new object is triggered by a > __call__ to the type object. In 2.0, this gets handled by the method > PythonCallBinderHelper.MakePythonTypeCallRule, which generates the > DLR expression tree that will actually implement the construction. It > doesn't look like it would look very easy to hook into this object > creation process. Hope that does not mean I'm doomed. Anyway, thanks for the hint. I'll investigate what I can do. > I take it that you need to provide the library with a Type object? I do not completely understand this statement. I assume you suggest me to extend PythonType to customize it's behaviour ? Thanks. From curt at hagenlocher.org Mon Apr 21 03:37:48 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Sun, 20 Apr 2008 18:37:48 -0700 Subject: [IronPython] Need help to port-dynamic class generation code to IP2 In-Reply-To: References: <1326.1208697200@boonthavorn.com> Message-ID: On Sun, Apr 20, 2008 at 6:21 PM, Sakesun Roykiattisak wrote: > > > I take it that you need to provide the library with a Type object? > > I do not completely understand this statement. I assume you suggest > me to extend PythonType to customize it's behaviour ? Not specifically; it's just that it would be easier to suggest an alternative solution if we knew what the specific requirements were for the library you're using. -- Curt Hagenlocher curt at hagenlocher.org From sakesun at boonthavorn.com Mon Apr 21 13:38:09 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Mon, 21 Apr 2008 18:38:09 +0700 Subject: [IronPython] Need help to port-dynamic class generation code to IP2 In-Reply-To: References: <1326.1208697200@boonthavorn.com> Message-ID: Curt, I just dig into my framework library again and find that they provide a hook to customize service component construction (It's not available last year, when I checked). So my problem is now solved. I still cannot move to 2.0, since some of my test cases are broken. I'll have to investigate it first. More questions will likely to come. :) Thank you very much. > Not specifically; it's just that it would be easier to suggest an > alternative solution if we knew what the specific requirements were > for the library you're using. From dan.eloff at gmail.com Mon Apr 21 16:03:08 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Mon, 21 Apr 2008 09:03:08 -0500 Subject: [IronPython] How do I import SourceCodeKind enumeration? Message-ID: <4817b6fc0804210703j48f130fbued6e36690053c631@mail.gmail.com> Using the source code for the DLR I've discovered that SourceCodeKind lives in Microsoft.Scripting, (and is public) but... >>> clr.AddReference('Microsoft.Scripting') >>> from Microsoft.Scripting import SourceCodeKind Traceback (most recent call last): File , line unknown, in Initialize##366 ImportError: Cannot import name SourceCodeKind How do I import it? Can you import enumerations? I need it for Engine.CreateScriptSourceFromString(str code, SourceCodeKind kind) Thanks, -Dan From curt at hagenlocher.org Mon Apr 21 17:57:57 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Mon, 21 Apr 2008 08:57:57 -0700 Subject: [IronPython] How do I import SourceCodeKind enumeration? In-Reply-To: <4817b6fc0804210703j48f130fbued6e36690053c631@mail.gmail.com> References: <4817b6fc0804210703j48f130fbued6e36690053c631@mail.gmail.com> Message-ID: On Mon, Apr 21, 2008 at 7:03 AM, Dan Eloff wrote: > > >>> clr.AddReference('Microsoft.Scripting') > >>> from Microsoft.Scripting import SourceCodeKind > Traceback (most recent call last): > File , line unknown, in Initialize##366 > ImportError: Cannot import name SourceCodeKind This works for me in 2.0 Beta 1. Which version are you using? -- Curt Hagenlocher curt at hagenlocher.org From dinov at exchange.microsoft.com Mon Apr 21 18:29:35 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 21 Apr 2008 09:29:35 -0700 Subject: [IronPython] How do I import SourceCodeKind enumeration? In-Reply-To: <4817b6fc0804210703j48f130fbued6e36690053c631@mail.gmail.com> References: <4817b6fc0804210703j48f130fbued6e36690053c631@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD7992@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Is this against beta 1 or the latest and greatest sources from CodePlex (or RubyForge :))? If it's the latest and greatest the DLR has been split into 2 separate parts: Microsoft.Scripting.dll and Microsoft.Scripting.Core.dll. SourceCodeKind is in the core so this works for me: import clr clr.AddReference('Microsoft.Scripting.Core') from Microsoft.Scripting import SourceCodeKind The reason for this change is that the DLR team is currently working through the layering of the DLR and figuring out what parts will end up in System.Core.dll for some future .NET release. So for a while code will be moving between these 2 DLLs. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff Sent: Monday, April 21, 2008 7:03 AM To: Discussion of IronPython Subject: [IronPython] How do I import SourceCodeKind enumeration? Using the source code for the DLR I've discovered that SourceCodeKind lives in Microsoft.Scripting, (and is public) but... >>> clr.AddReference('Microsoft.Scripting') >>> from Microsoft.Scripting import SourceCodeKind Traceback (most recent call last): File , line unknown, in Initialize##366 ImportError: Cannot import name SourceCodeKind How do I import it? Can you import enumerations? I need it for Engine.CreateScriptSourceFromString(str code, SourceCodeKind kind) Thanks, -Dan _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Apr 21 18:31:38 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 21 Apr 2008 09:31:38 -0700 Subject: [IronPython] Need help to port-dynamic class generation code to IP2 In-Reply-To: References: <1326.1208697200@boonthavorn.com> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD7997@DF-GRTDANE-MSG.exchange.corp.microsoft.com> FYI if this became a blocker I think we could probably fix this so your scenario would work. Personally I'd rather spend the time fixing other bugs but I am sympathetic to wanting to interact w/ libraries that want to be able to create instance of types. The underlying problem here is the test is going to be made against PythonType.UnderlyingSystemType and because you've derived from it we'll get that wrong. We could send the real type down into the code that makes the test. Anyway, it'll be interesting to hear what the other problems are. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sakesun Roykiattisak Sent: Monday, April 21, 2008 4:38 AM To: users at lists.ironpython.com Subject: Re: [IronPython] Need help to port-dynamic class generation code to IP2 Curt, I just dig into my framework library again and find that they provide a hook to customize service component construction (It's not available last year, when I checked). So my problem is now solved. I still cannot move to 2.0, since some of my test cases are broken. I'll have to investigate it first. More questions will likely to come. :) Thank you very much. > Not specifically; it's just that it would be easier to suggest an > alternative solution if we knew what the specific requirements were > for the library you're using. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Mon Apr 21 18:48:09 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 21 Apr 2008 09:48:09 -0700 Subject: [IronPython] More Performance comparisons - dictionary updates and tuples In-Reply-To: <48063834.8020703@voidspace.org.uk> References: <48063834.8020703@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD79B4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> BTW I did get a chance to look at this and I believe I have solutions for these issues including a new and improved tuple hash. It is an interesting test case though... So looking at the scenarios here: Tuple create and unpack - we're actually not much slower at the actual tuple create / unpack here, but we are slower. We can detect the common parallel assignment case and optimize it into temporary variables rather than creating an object array, a tuple, an enumerator for the tuple, and pulling out the individual values. Once I did that the times seemed comparable. But switching from a range to an xrange gave IronPython a speed advantage. So range apparently has more overhead than CPython and with such a small loop it starts to show up. On the dictionary performance - the new dictionaries really favor reading more than writing. Previously in 1.x we required locking on both reads and writes to dictionaries. The new dictionaries are thread safe for 1 writer and multiple readers. The trade off here is that our resizes are more expensive. Unfortunately they were particularly more expensive than they needed to be - we would rehash everything on resize. And update was just copy everything from one dictionary to another, potentially resizing multiple times along the way, doing tons of unnecessary hashing. It's easy enough to make update pre-allocate the end size and also avoid rehashing all the values. That gets us competitive again. The int's also got sped up by this change to the point where they're close to 1.x but they're not quite the same speed. This seems to mostly come back to the different performance characteristics of our new dictionaries and the resizing issue. There's probably still some more tuning to be done on our dictionaries over time. We're also not going to be beating CPython's highly-tuned dictionaries anytime soon but at least we should be much more competitive now. I haven't got the changes checked in yet but hopefully over the next few days they'll make it in. Then I might have some more performance info to share as I'll get runs against a large number of tests. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Wednesday, April 16, 2008 10:33 AM To: Discussion of IronPython Subject: [IronPython] More Performance comparisons - dictionary updates and tuples Hello guys, I've been looking at performance in Resolver One. (Object creation in IronPython seems to be really good whereas dictionary lookups not so good when we compare against CPython.) It turns out that we are getting bitten quite badly by the performance of hashing tuples (fixing this for IP 1.1.2 would be *great*). I did some profiling and have some comparisons - and can also show a regression in performance in IP 2 (Beta 1) when using ints as dictionary keys in an update operation. I thought I would post the results as they may be useful. (Dictionary update in IP 1 with tuple keys is an order of magnitude slower than CPython. So is IP 2 but still twice as good as IP 1 - two times *worse* than IP 1 for tuple creating and unpacking though.) Results first: CPython e:\Dev>timeit1.py tuple_create_and_unpack took 220.999956131 ms dict_update took 541.000127792 ms IP 1.1.1 e:\Dev>e:\Dev\ironpython1\ipy.exe timeit1.py tuple_create_and_unpack took 680.9792 ms dict_update took 7891.3472 ms IP 2 Beta 1 e:\Dev>e:\Dev\ironpython2\ipy.exe timeit1.py tuple_create_and_unpack took 1341.9296 ms dict_update took 4756.84 ms If we switch to using integers rather than tuples for the dictionary keys, the performance changes: CPython e:\Dev>timeit1.py tuple_create_and_unpack took 200.000047684 ms dict_update took 230.999946594 ms IP 1.1.1 e:\Dev>e:\Dev\ironpython1\ipy.exe timeit1.py tuple_create_and_unpack took 911.3104 ms dict_update took 420.6048 ms IP 2 Beta 1 e:\Dev>e:\Dev\ironpython2\ipy.exe timeit1.py tuple_create_and_unpack took 971.3968 ms dict_update took 1582.2752 ms With ints as keys, IP 1 is only half the speed of CPython - but IP 2 is four times slower than IP 1! The code used - which runs under both CPython and IronPython from random import random try: import clr from System import DateTime def timeit(func): start = DateTime.Now func() end = DateTime.Now print func.__name__, 'took %s ms' % (end - start).TotalMilliseconds except ImportError: import time def timeit(func): start = time.time() func() end = time.time() print func.__name__, 'took %s ms' % ((end - start) * 1000) def tuple_create_and_unpack(): for val in range(1000000): a, b = val, val + 1 d1 = {} for x in range(100): for y in range(100): d1[x, y] = random() d2 = {} for x in range(1000): for y in range(1000): d2[x, y] = random() def dict_update(): d1.update(d2) timeit(tuple_create_and_unpack) timeit(dict_update) Michael Foord http://www.ironpythoninaction.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Apr 21 19:29:34 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 21 Apr 2008 18:29:34 +0100 Subject: [IronPython] More Performance comparisons - dictionary updates and tuples In-Reply-To: <7AD436E4270DD54A94238001769C22270126F9FD79B4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <48063834.8020703@voidspace.org.uk> <7AD436E4270DD54A94238001769C22270126F9FD79B4@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <480CCEFE.8020502@voidspace.org.uk> Dino this all sounds good. FWIW I think we can get some advantage in a couple of places in our code by switching from range to xrange. General dictionary performance is critical of course. Michael Foord http://www.ironpythoninaction.com/ Dino Viehland wrote: > BTW I did get a chance to look at this and I believe I have solutions for these issues including a new and improved tuple hash. It is an interesting test case though... > > So looking at the scenarios here: > Tuple create and unpack - we're actually not much slower at the actual tuple create / unpack here, but we are slower. We can detect the common parallel assignment case and optimize it into temporary variables rather than creating an object array, a tuple, an enumerator for the tuple, and pulling out the individual values. Once I did that the times seemed comparable. But switching from a range to an xrange gave IronPython a speed advantage. So range apparently has more overhead than CPython and with such a small loop it starts to show up. > > On the dictionary performance - the new dictionaries really favor reading more than writing. Previously in 1.x we required locking on both reads and writes to dictionaries. The new dictionaries are thread safe for 1 writer and multiple readers. The trade off here is that our resizes are more expensive. Unfortunately they were particularly more expensive than they needed to be - we would rehash everything on resize. And update was just copy everything from one dictionary to another, potentially resizing multiple times along the way, doing tons of unnecessary hashing. It's easy enough to make update pre-allocate the end size and also avoid rehashing all the values. That gets us competitive again. > > The int's also got sped up by this change to the point where they're close to 1.x but they're not quite the same speed. This seems to mostly come back to the different performance characteristics of our new dictionaries and the resizing issue. > > There's probably still some more tuning to be done on our dictionaries over time. We're also not going to be beating CPython's highly-tuned dictionaries anytime soon but at least we should be much more competitive now. I haven't got the changes checked in yet but hopefully over the next few days they'll make it in. Then I might have some more performance info to share as I'll get runs against a large number of tests. > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Wednesday, April 16, 2008 10:33 AM > To: Discussion of IronPython > Subject: [IronPython] More Performance comparisons - dictionary updates and tuples > > Hello guys, > > I've been looking at performance in Resolver One. (Object creation in > IronPython seems to be really good whereas dictionary lookups not so > good when we compare against CPython.) > > It turns out that we are getting bitten quite badly by the performance > of hashing tuples (fixing this for IP 1.1.2 would be *great*). I did > some profiling and have some comparisons - and can also show a > regression in performance in IP 2 (Beta 1) when using ints as dictionary > keys in an update operation. I thought I would post the results as they > may be useful. > > (Dictionary update in IP 1 with tuple keys is an order of magnitude > slower than CPython. So is IP 2 but still twice as good as IP 1 - two > times *worse* than IP 1 for tuple creating and unpacking though.) > > Results first: > > CPython > e:\Dev>timeit1.py > tuple_create_and_unpack took 220.999956131 ms > dict_update took 541.000127792 ms > > > IP 1.1.1 > e:\Dev>e:\Dev\ironpython1\ipy.exe timeit1.py > tuple_create_and_unpack took 680.9792 ms > dict_update took 7891.3472 ms > > > IP 2 Beta 1 > e:\Dev>e:\Dev\ironpython2\ipy.exe timeit1.py > tuple_create_and_unpack took 1341.9296 ms > dict_update took 4756.84 ms > > > If we switch to using integers rather than tuples for the dictionary > keys, the performance changes: > > CPython > e:\Dev>timeit1.py > tuple_create_and_unpack took 200.000047684 ms > dict_update took 230.999946594 ms > > > IP 1.1.1 > e:\Dev>e:\Dev\ironpython1\ipy.exe timeit1.py > tuple_create_and_unpack took 911.3104 ms > dict_update took 420.6048 ms > > > IP 2 Beta 1 > e:\Dev>e:\Dev\ironpython2\ipy.exe timeit1.py > tuple_create_and_unpack took 971.3968 ms > dict_update took 1582.2752 ms > > > With ints as keys, IP 1 is only half the speed of CPython - but IP 2 is > four times slower than IP 1! > > The code used - which runs under both CPython and IronPython > > > from random import random > > try: > import clr > from System import DateTime > > def timeit(func): > start = DateTime.Now > func() > end = DateTime.Now > print func.__name__, 'took %s ms' % (end - start).TotalMilliseconds > > except ImportError: > import time > > def timeit(func): > start = time.time() > func() > end = time.time() > print func.__name__, 'took %s ms' % ((end - start) * 1000) > > > def tuple_create_and_unpack(): > for val in range(1000000): > a, b = val, val + 1 > > d1 = {} > for x in range(100): > for y in range(100): > d1[x, y] = random() > > d2 = {} > for x in range(1000): > for y in range(1000): > d2[x, y] = random() > > def dict_update(): > d1.update(d2) > > timeit(tuple_create_and_unpack) > timeit(dict_update) > > > Michael Foord > http://www.ironpythoninaction.com/ > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dan.eloff at gmail.com Mon Apr 21 20:07:07 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Mon, 21 Apr 2008 13:07:07 -0500 Subject: [IronPython] How do I import SourceCodeKind enumeration? In-Reply-To: <7AD436E4270DD54A94238001769C22270126F9FD7992@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <4817b6fc0804210703j48f130fbued6e36690053c631@mail.gmail.com> <7AD436E4270DD54A94238001769C22270126F9FD7992@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <4817b6fc0804211107oedd4b92j982fac1162d37c64@mail.gmail.com> Aha! Thanks Dino, that explains it. I've added the reference to Microsoft.Scripting.Core and it works now. Cheers, -Dan On Mon, Apr 21, 2008 at 11:29 AM, Dino Viehland wrote: > Is this against beta 1 or the latest and greatest sources from CodePlex (or RubyForge :))? > > If it's the latest and greatest the DLR has been split into 2 separate parts: Microsoft.Scripting.dll and Microsoft.Scripting.Core.dll. SourceCodeKind is in the core so this works for me: > > import clr > clr.AddReference('Microsoft.Scripting.Core') > > from Microsoft.Scripting import SourceCodeKind > > The reason for this change is that the DLR team is currently working through the layering of the DLR and figuring out what parts will end up in System.Core.dll for some future .NET release. So for a while code will be moving between these 2 DLLs. > > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff > Sent: Monday, April 21, 2008 7:03 AM > To: Discussion of IronPython > Subject: [IronPython] How do I import SourceCodeKind enumeration? > > Using the source code for the DLR I've discovered that SourceCodeKind > lives in Microsoft.Scripting, (and is public) but... > > >>> clr.AddReference('Microsoft.Scripting') > >>> from Microsoft.Scripting import SourceCodeKind > Traceback (most recent call last): > File , line unknown, in Initialize##366 > ImportError: Cannot import name SourceCodeKind > > How do I import it? Can you import enumerations? > > I need it for Engine.CreateScriptSourceFromString(str code, SourceCodeKind kind) > > Thanks, > -Dan > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dan.eloff at gmail.com Mon Apr 21 21:57:02 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Mon, 21 Apr 2008 14:57:02 -0500 Subject: [IronPython] sys.excepthook doesn't work in Silverlight? Message-ID: <4817b6fc0804211257v5d8d7a83p603a415620cbb2c1@mail.gmail.com> Try raising an error in an event handler in Silverlight, it will not go to sys.excepthook. How else can I catch exceptions raised from event handlers? (without adding try/except in each handler?) I'd like to catch all exceptions raised by my Silverlight application and display them in Silverlight. Thanks, -Dan From fuzzyman at voidspace.org.uk Tue Apr 22 00:21:04 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 21 Apr 2008 23:21:04 +0100 Subject: [IronPython] Powershell Sample and IP 2 Message-ID: <480D1350.6020304@voidspace.org.uk> Hello all, Just to let you know that the IronPython Powershell sample is broken for IronPython 2: >>> from powershell import shell Traceback (most recent call last): File , line unknown, in Initialize##224 File , line unknown, in _stub_##3 File Snippets, line unknown, in Initialize File Snippets, line unknown, in init_runspace AttributeError: 'dictproxy' object has no attribute 'update' :-( Michael http://www.ironpythoninaction.com/ From sakesun at boonthavorn.com Tue Apr 22 12:18:43 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Tue, 22 Apr 2008 17:18:43 +0700 Subject: [IronPython] shall #14454 be fixed for 1.X ? Message-ID: Hi, The 2.0beta is not stable enough for me to work with yet. But 1.1 is leaking memory and not applicable for long running server application. http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=14454 Wonder how hard to fix #14454 in 1.1 ? From fuzzyman at voidspace.org.uk Tue Apr 22 12:24:47 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 22 Apr 2008 11:24:47 +0100 Subject: [IronPython] shall #14454 be fixed for 1.X ? In-Reply-To: References: Message-ID: <480DBCEF.9050800@voidspace.org.uk> Sakesun Roykiattisak wrote: >Hi, > >The 2.0beta is not stable enough for me to work with yet. >But 1.1 is leaking memory and not applicable for long running server >application. > >http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=14454 > >Wonder how hard to fix #14454 in 1.1 ? > > Note that you can 'fix' this yourself by unsubscribing from events when you have finished with them. It would be nice to see this fixed - so long as it doesn't cause problems when you use lambda functions (or other functions that you aren't directly keeping a reference to) as event handlers. Michael Foord http://www.ironpythoninaction.com/ >_______________________________________________ >Users mailing list >Users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From sakesun at boonthavorn.com Tue Apr 22 13:40:46 2008 From: sakesun at boonthavorn.com (=?utf-8?B?IOC5gOC4quC4geC4quC4o+C4o+C4hOC5jA==?=) Date: Tue, 22 Apr 2008 18:40:46 +0700 Subject: [IronPython] shall #14454 be fixed for 1.X ? Message-ID: <2357.1208864446@boonthavorn.com> Note that you can 'fix' this yourself by unsubscribing from events when you have finished with them. I've spend my whold today doing what you've mentioned without any success yet. The framework I based on depends heavily on a really complicate event sequences that I can hardly comprehend. Perhaps, tomorrow I'll have a better luck. Thanks. ------------------------- Msg sent via @Mail Softnix Messaging Server http://www.softnix.co.th -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Tue Apr 22 17:19:33 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 22 Apr 2008 08:19:33 -0700 Subject: [IronPython] shall #14454 be fixed for 1.X ? In-Reply-To: <480DBCEF.9050800@voidspace.org.uk> References: <480DBCEF.9050800@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD7C95@DF-GRTDANE-MSG.exchange.corp.microsoft.com> It shouldn't cause the lambda's to be lost. The picture ends up looking like: +-----------+ +-----------+ | Object W/ | | | | Event ---+- strong ref----> | Lambda | +-----------+ +-----------+ +------------------------------------+ | Dictionary | | KeyValuePair 0: | | Key: WeakRef -> Object W/ Event | | Value: WeakRef -> Lambda | +------------------------------------+ So long as your object w/ an event remains rooted it has a strong reference to the lambda. If the reference to the object w/ the event is lost then both objects can be collected. It should be fairly straight forward to port this back to 1.1. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Tuesday, April 22, 2008 3:25 AM To: Discussion of IronPython Subject: Re: [IronPython] shall #14454 be fixed for 1.X ? Sakesun Roykiattisak wrote: >Hi, > >The 2.0beta is not stable enough for me to work with yet. >But 1.1 is leaking memory and not applicable for long running server >application. > >http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=14454 > >Wonder how hard to fix #14454 in 1.1 ? > > Note that you can 'fix' this yourself by unsubscribing from events when you have finished with them. It would be nice to see this fixed - so long as it doesn't cause problems when you use lambda functions (or other functions that you aren't directly keeping a reference to) as event handlers. Michael Foord http://www.ironpythoninaction.com/ >_______________________________________________ >Users mailing list >Users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Tue Apr 22 17:22:17 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 22 Apr 2008 16:22:17 +0100 Subject: [IronPython] shall #14454 be fixed for 1.X ? In-Reply-To: <7AD436E4270DD54A94238001769C22270126F9FD7C95@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <480DBCEF.9050800@voidspace.org.uk> <7AD436E4270DD54A94238001769C22270126F9FD7C95@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <480E02A9.2030909@voidspace.org.uk> Great! Thanks Dino. Michael Dino Viehland wrote: >It shouldn't cause the lambda's to be lost. The picture ends up looking like: > >+-----------+ +-----------+ >| Object W/ | | | >| Event ---+- strong ref----> | Lambda | >+-----------+ +-----------+ > >+------------------------------------+ >| Dictionary | >| KeyValuePair 0: | >| Key: WeakRef -> Object W/ Event | >| Value: WeakRef -> Lambda | >+------------------------------------+ > >So long as your object w/ an event remains rooted it has a strong reference to the lambda. If the reference to the object w/ the event is lost then both objects can be collected. > >It should be fairly straight forward to port this back to 1.1. > >-----Original Message----- >From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord >Sent: Tuesday, April 22, 2008 3:25 AM >To: Discussion of IronPython >Subject: Re: [IronPython] shall #14454 be fixed for 1.X ? > >Sakesun Roykiattisak wrote: > > > >>Hi, >> >>The 2.0beta is not stable enough for me to work with yet. >>But 1.1 is leaking memory and not applicable for long running server >>application. >> >>http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=14454 >> >>Wonder how hard to fix #14454 in 1.1 ? >> >> >> >> > >Note that you can 'fix' this yourself by unsubscribing from events when >you have finished with them. > >It would be nice to see this fixed - so long as it doesn't cause >problems when you use lambda functions (or other functions that you >aren't directly keeping a reference to) as event handlers. > >Michael Foord >http://www.ironpythoninaction.com/ > > > >>_______________________________________________ >>Users mailing list >>Users at lists.ironpython.com >>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> >> >> > >_______________________________________________ >Users mailing list >Users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >_______________________________________________ >Users mailing list >Users at lists.ironpython.com >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > From dinov at exchange.microsoft.com Tue Apr 22 17:31:22 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 22 Apr 2008 08:31:22 -0700 Subject: [IronPython] shall #14454 be fixed for 1.X ? In-Reply-To: <2357.1208864446@boonthavorn.com> References: <2357.1208864446@boonthavorn.com> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD7C9A@DF-GRTDANE-MSG.exchange.corp.microsoft.com> If you?re really stuck you could port the beta 2 event handling code back to 1.x and run against your own private build - at least until we do 1.1.2 ? I?m not yet sure when we?ll do that but I?ll make sure we discuss it this week. It?s not super straight forward, because we now hook each delegate independently to the object which enables this to work, but it?s not too bad either. ReflectedMembers.cs in ReflectedEvent.InPlaceAdd would be the place to start looking in 1.x and ReflectedEvent.cs again in ReflectedEvent.InPlaceAdd would be the 2.x side of things. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of ???????? Sent: Tuesday, April 22, 2008 4:41 AM To: Discussion of IronPython Subject: Re: [IronPython] shall #14454 be fixed for 1.X ? Note that you can 'fix' this yourself by unsubscribing from events when you have finished with them. I've spend my whold today doing what you've mentioned without any success yet. The framework I based on depends heavily on a really complicate event sequences that I can hardly comprehend. Perhaps, tomorrow I'll have a better luck. Thanks. ________________________________ Msg sent via @Mail Softnix Messaging Server http://www.softnix.co.th -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.eloff at gmail.com Tue Apr 22 20:19:34 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 22 Apr 2008 13:19:34 -0500 Subject: [IronPython] Implementing sys.excepthook Message-ID: <4817b6fc0804221119h7f7b87e4h17fa0f1a468d5e50@mail.gmail.com> I really want to see sys.excepthook in IronPython. The way I see it there's two problems. 1) You cannot assign to the sys module. So we need a fix or workaround for that. This is the hard part. 2) We also need to intercept exceptions before they leave IPY and route them to sys.excepthook, which should be set to __excepthook__ by default, which needs to be a function that raises the exception in the way they would have been before interception. I have no idea how to assess the complexity of these problems, or how to solve them. I'm quite happy to offer any help required here, but I'll need some direction. I have created and embedded an IronPython interactive interpreter into my Silverlight application. I want to use sys.excepthook to catch exceptions, print them in the console, and have a combo box of stack frames that you can jump around and inspect on the fly (like Wing IDE's debug probe.) It would also work with little or no modification in WPF applications. I've done similar things with CPython and wxPython, and found that it really speeds up the development cycle. I want to have the same functionality in IronPython. -Dan From dfugate at microsoft.com Tue Apr 22 21:03:14 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Tue, 22 Apr 2008 12:03:14 -0700 Subject: [IronPython] Powershell Sample and IP 2 In-Reply-To: <480D1350.6020304@voidspace.org.uk> References: <480D1350.6020304@voidspace.org.uk> Message-ID: <7346A825E148B049A9AD1D3ED46A2D9125A05E753F@NA-EXMSG-C106.redmond.corp.microsoft.com> Thanks for reporting this Michael! We actually discovered this internally about a year ago in one of the 2.0 Alphas, and made a few changes to get it (mostly) working again: E:\Merlin\Main\Languages\IronPython\Samples\IPPowerShell>ipyd IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1434 Copyright (c) Microsoft Corporation. All rights reserved. >>> from powershell import shell >>> At this point I think we'll probably end up re-releasing some of the IP 1.0 samples shortly after IP 2.0 RTM. If you're interested in getting this working under Beta 1 now, the change is fairly simple - replace "ShellOutput.__dict__.update(cmds)" in powershell.py with "ShellOutput.out_string = ShellCommand("Out-String")". Hope that helps. Dave -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Monday, April 21, 2008 3:21 PM To: Discussion of IronPython Subject: [IronPython] Powershell Sample and IP 2 Hello all, Just to let you know that the IronPython Powershell sample is broken for IronPython 2: >>> from powershell import shell Traceback (most recent call last): File , line unknown, in Initialize##224 File , line unknown, in _stub_##3 File Snippets, line unknown, in Initialize File Snippets, line unknown, in init_runspace AttributeError: 'dictproxy' object has no attribute 'update' :-( Michael http://www.ironpythoninaction.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Tue Apr 22 22:54:20 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Tue, 22 Apr 2008 21:54:20 +0100 Subject: [IronPython] Powershell Sample and IP 2 In-Reply-To: <7346A825E148B049A9AD1D3ED46A2D9125A05E753F@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <480D1350.6020304@voidspace.org.uk> <7346A825E148B049A9AD1D3ED46A2D9125A05E753F@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <480E507C.9020003@voidspace.org.uk> Dave Fugate wrote: > Thanks for reporting this Michael! We actually discovered this internally about a year ago in one of the 2.0 Alphas, and made a few changes to get it (mostly) working again: > E:\Merlin\Main\Languages\IronPython\Samples\IPPowerShell>ipyd > IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1434 > Copyright (c) Microsoft Corporation. All rights reserved. > >>> from powershell import shell > >>> > > At this point I think we'll probably end up re-releasing some of the IP 1.0 samples shortly after IP 2.0 RTM. If you're interested in getting this working under Beta 1 now, the change is fairly simple - replace "ShellOutput.__dict__.update(cmds)" in powershell.py with "ShellOutput.out_string = ShellCommand("Out-String")". Hope that helps. > > Well - that isn't an uncommon usage pattern in Python - so the bug that prevents you updating into an instance dict should be fixed as well. :-) Michael > Dave > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, April 21, 2008 3:21 PM > To: Discussion of IronPython > Subject: [IronPython] Powershell Sample and IP 2 > > Hello all, > > Just to let you know that the IronPython Powershell sample is broken for > IronPython 2: > > >>> from powershell import shell > Traceback (most recent call last): > File , line unknown, in Initialize##224 > File , line unknown, in _stub_##3 > File Snippets, line unknown, in Initialize > File Snippets, line unknown, in init_runspace > AttributeError: 'dictproxy' object has no attribute 'update' > > :-( > > Michael > http://www.ironpythoninaction.com/ > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Tue Apr 22 23:13:30 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Tue, 22 Apr 2008 14:13:30 -0700 Subject: [IronPython] Implementing sys.excepthook In-Reply-To: <4817b6fc0804221119h7f7b87e4h17fa0f1a468d5e50@mail.gmail.com> References: <4817b6fc0804221119h7f7b87e4h17fa0f1a468d5e50@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD7E36@DF-GRTDANE-MSG.exchange.corp.microsoft.com> #1 shouldn't be a problem - is this only in the Silverlight builds? Certainly the current desktop IronPython builds allow assignment to sys (both overwriting existing members as well as creating new members). But I'd expect that to have worked more or less forever. For #2 I believe what we want to do is change Python's PythonContext.FormatException to call excepthook. That's not 100% correct but it'll get pretty close to the right time when excepthook should be called - especially for Silverlight where we won't have another chance to really do it. But Silverlight is going to try and replace your page w/ it's own error page so the end result won't be quite what you want. I've gone ahead and opened a bug for this (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16242). If you (and anyone else) could vote on it it'll drive the priority up and we'll fix it sooner rather than later :). -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff Sent: Tuesday, April 22, 2008 11:20 AM To: Discussion of IronPython Subject: [IronPython] Implementing sys.excepthook I really want to see sys.excepthook in IronPython. The way I see it there's two problems. 1) You cannot assign to the sys module. So we need a fix or workaround for that. This is the hard part. 2) We also need to intercept exceptions before they leave IPY and route them to sys.excepthook, which should be set to __excepthook__ by default, which needs to be a function that raises the exception in the way they would have been before interception. I have no idea how to assess the complexity of these problems, or how to solve them. I'm quite happy to offer any help required here, but I'll need some direction. I have created and embedded an IronPython interactive interpreter into my Silverlight application. I want to use sys.excepthook to catch exceptions, print them in the console, and have a combo box of stack frames that you can jump around and inspect on the fly (like Wing IDE's debug probe.) It would also work with little or no modification in WPF applications. I've done similar things with CPython and wxPython, and found that it really speeds up the development cycle. I want to have the same functionality in IronPython. -Dan _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dan.eloff at gmail.com Tue Apr 22 23:38:58 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 22 Apr 2008 16:38:58 -0500 Subject: [IronPython] Implementing sys.excepthook In-Reply-To: <7AD436E4270DD54A94238001769C22270126F9FD7E36@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <4817b6fc0804221119h7f7b87e4h17fa0f1a468d5e50@mail.gmail.com> <7AD436E4270DD54A94238001769C22270126F9FD7E36@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <4817b6fc0804221438y674dda2fke6fbf35047427eba@mail.gmail.com> On Tue, Apr 22, 2008 at 4:13 PM, Dino Viehland wrote: > #1 shouldn't be a problem - is this only in the Silverlight builds? Certainly the current desktop IronPython builds allow assignment to sys (both overwriting existing members as well as creating new members). But I'd expect that to have worked more or less forever. I read that somewhere about IronPython, but it must have long since stopped being an issue. This explains why I can assign to sys.excepthook without error in Silverlight. That's 1 down. > For #2 I believe what we want to do is change Python's PythonContext.FormatException to call excepthook. That's not 100% correct but it'll get pretty close to the right time when excepthook should be called - especially for Silverlight where we won't have another chance to really do it. But Silverlight is going to try and replace your page w/ it's own error page so the end result won't be quite what you want. The trouble with that, if I understand you, is that by the time you're formatting the exception, it's already reached Silverlight and is going to continue the rest of the distance (Silverlight popping up it's error page.) In CPython sys.excepthook bypasses the normal mechanism of printing the traceback to stderr, unless you do that in your excepthook function, nothing will be printed. Can we do better here, and get functionality closer to CPython? It will save headaches down the road. I really want to get sys.excepthook in before FormatException, right about the point where the exception has bubbled to the top python frame and is about to leave to wherever it goes next. In a simple world you can simulate sys.excepthook by wrapping the main entry point in try/except and calling sys.excepthook in the except clause. In real life, all asynchronus callbacks that are invoked by the CLR machinery are also entry points in this respect, and they'd have to be wrapped too. Thanks for your interest! -Dan From dfugate at microsoft.com Wed Apr 23 01:03:00 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Tue, 22 Apr 2008 16:03:00 -0700 Subject: [IronPython] Powershell Sample and IP 2 In-Reply-To: <480E507C.9020003@voidspace.org.uk> References: <480D1350.6020304@voidspace.org.uk> <7346A825E148B049A9AD1D3ED46A2D9125A05E753F@NA-EXMSG-C106.redmond.corp.microsoft.com> <480E507C.9020003@voidspace.org.uk> Message-ID: <7346A825E148B049A9AD1D3ED46A2D9125A05E7734@NA-EXMSG-C106.redmond.corp.microsoft.com> I could be mistaken, but I think it was actually a bug that we did in fact allow calling update on new-style class dictionaries in 1.0: IronPython 1.0.60816 on .NET 2.0.50727.1434 Copyright (c) Microsoft Corporation. All rights reserved. >>> class K(object): pass ... >>> hasattr(K.__dict__, "update") True Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> class K(object): pass ... >>> hasattr(K.__dict__, "update") False IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1434 Copyright (c) Microsoft Corporation. All rights reserved. >>> class K(object): pass ... >>> hasattr(K.__dict__, "update") False -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Tuesday, April 22, 2008 1:54 PM To: Discussion of IronPython Subject: Re: [IronPython] Powershell Sample and IP 2 Dave Fugate wrote: > Thanks for reporting this Michael! We actually discovered this internally about a year ago in one of the 2.0 Alphas, and made a few changes to get it (mostly) working again: > E:\Merlin\Main\Languages\IronPython\Samples\IPPowerShell>ipyd > IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1434 > Copyright (c) Microsoft Corporation. All rights reserved. > >>> from powershell import shell > >>> > > At this point I think we'll probably end up re-releasing some of the IP 1.0 samples shortly after IP 2.0 RTM. If you're interested in getting this working under Beta 1 now, the change is fairly simple - replace "ShellOutput.__dict__.update(cmds)" in powershell.py with "ShellOutput.out_string = ShellCommand("Out-String")". Hope that helps. > > Well - that isn't an uncommon usage pattern in Python - so the bug that prevents you updating into an instance dict should be fixed as well. :-) Michael > Dave > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Monday, April 21, 2008 3:21 PM > To: Discussion of IronPython > Subject: [IronPython] Powershell Sample and IP 2 > > Hello all, > > Just to let you know that the IronPython Powershell sample is broken for > IronPython 2: > > >>> from powershell import shell > Traceback (most recent call last): > File , line unknown, in Initialize##224 > File , line unknown, in _stub_##3 > File Snippets, line unknown, in Initialize > File Snippets, line unknown, in init_runspace > AttributeError: 'dictproxy' object has no attribute 'update' > > :-( > > Michael > http://www.ironpythoninaction.com/ > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Wed Apr 23 01:08:02 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Wed, 23 Apr 2008 00:08:02 +0100 Subject: [IronPython] Powershell Sample and IP 2 In-Reply-To: <7346A825E148B049A9AD1D3ED46A2D9125A05E7734@NA-EXMSG-C106.redmond.corp.microsoft.com> References: <480D1350.6020304@voidspace.org.uk> <7346A825E148B049A9AD1D3ED46A2D9125A05E753F@NA-EXMSG-C106.redmond.corp.microsoft.com> <480E507C.9020003@voidspace.org.uk> <7346A825E148B049A9AD1D3ED46A2D9125A05E7734@NA-EXMSG-C106.redmond.corp.microsoft.com> Message-ID: <480E6FD2.2090101@voidspace.org.uk> Dave Fugate wrote: > I could be mistaken, but I think it was actually a bug that we did in fact allow calling update on new-style class dictionaries in 1.0: > Ah - it is updating on the class rather than the instance - my mistake... (should be allowed IMHO - but that isn't your fault :-) Michael Foord http://www.ironpythoninaction.com/ > IronPython 1.0.60816 on .NET 2.0.50727.1434 > Copyright (c) Microsoft Corporation. All rights reserved. > >>> class K(object): pass > ... > >>> hasattr(K.__dict__, "update") > True > > Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> class K(object): pass > ... > >>> hasattr(K.__dict__, "update") > False > > IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1434 > Copyright (c) Microsoft Corporation. All rights reserved. > >>> class K(object): pass > ... > >>> hasattr(K.__dict__, "update") > False > > > > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Tuesday, April 22, 2008 1:54 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Powershell Sample and IP 2 > > Dave Fugate wrote: > >> Thanks for reporting this Michael! We actually discovered this internally about a year ago in one of the 2.0 Alphas, and made a few changes to get it (mostly) working again: >> E:\Merlin\Main\Languages\IronPython\Samples\IPPowerShell>ipyd >> IronPython 2.0 Beta (2.0.0.1000) on .NET 2.0.50727.1434 >> Copyright (c) Microsoft Corporation. All rights reserved. >> >>> from powershell import shell >> >>> >> >> At this point I think we'll probably end up re-releasing some of the IP 1.0 samples shortly after IP 2.0 RTM. If you're interested in getting this working under Beta 1 now, the change is fairly simple - replace "ShellOutput.__dict__.update(cmds)" in powershell.py with "ShellOutput.out_string = ShellCommand("Out-String")". Hope that helps. >> >> >> > > Well - that isn't an uncommon usage pattern in Python - so the bug that > prevents you updating into an instance dict should be fixed as well. :-) > > Michael > > >> Dave >> >> >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Monday, April 21, 2008 3:21 PM >> To: Discussion of IronPython >> Subject: [IronPython] Powershell Sample and IP 2 >> >> Hello all, >> >> Just to let you know that the IronPython Powershell sample is broken for >> IronPython 2: >> >> >>> from powershell import shell >> Traceback (most recent call last): >> File , line unknown, in Initialize##224 >> File , line unknown, in _stub_##3 >> File Snippets, line unknown, in Initialize >> File Snippets, line unknown, in init_runspace >> AttributeError: 'dictproxy' object has no attribute 'update' >> >> :-( >> >> Michael >> http://www.ironpythoninaction.com/ >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From sakesun at boonthavorn.com Wed Apr 23 09:23:09 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Wed, 23 Apr 2008 14:23:09 +0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? Message-ID: Hi, My today attempt to fight with over-memory usage in my IronPython server application, reveal a very strange behavior of IronPython (both 1.1 and 2.0b) I'll demonstrate with the following script: "loopit.py" ##### loopit.py ########################### import clr #clr.AddReference('System') class MyObj(object): def __del__(self): print 'gone' def run(): from System.Threading import Thread from System import GC while True: MyObj() Thread.Sleep(100) GC.Collect() run() ########################################### try to run this script you'll see a stream of 'gone' print out. However, if you uncomment the line "clr.AddReference('System')" and rerun it again the system will simple halt, memory usage will keep raising. Until you press Ctrl-C, then the you will see the pending 'gone' stream out. I've tried with clr.AddReference('System.Data') clr.AddReference('System.Xml') and the behaviour is the same for any Assembly. This is really weird. Why should clr.AddReference effect how GC work ? And I believe this is indeed the true source of memory problem I'm facing. Hope someone explain me why. Thanks -------------- next part -------------- A non-text attachment was scrubbed... Name: loopit.py Type: text/x-python Size: 261 bytes Desc: not available URL: From cemasoniv at gmail.com Wed Apr 23 15:31:16 2008 From: cemasoniv at gmail.com (Charles Mason) Date: Wed, 23 Apr 2008 09:31:16 -0400 Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python objects In-Reply-To: <3290753a0804230626h99a309ci975ad35dabcc2c35@mail.gmail.com> References: <3290753a0804230626h99a309ci975ad35dabcc2c35@mail.gmail.com> Message-ID: <3290753a0804230631w73b143e8vf805902b96af26b6@mail.gmail.com> So I've been through hell last night tearing my hear out trying to figure out how to work PropertyGrid properly with a Python class object. Things I've tried: 1) In Python, PropertyGrid.SelectedObject = pythonobj 2) In Python, Deriving PropertyGrid and overriding CreatePropertyTab 3) In C#, deriving a new class from PropertyGrid and implementing public void SetPythonObject(Object obj) { this.SelectedObject = obj; } 4) In C#, Overriding CreatePropertyTab() (I get a warning about hiding a baseclass implementation -- sounds like this isn't overrideable) 5) In C#, creating a wrapper class: class CustomHolder { private Object heldObj = null; public Object held { get { return heldObj; } set { heldObj = value; } } CustomHolder(Object obj) { this.held = obj; } } and in the derived PropertyGrid class: public void SetPythonObject(Object obj) { this.SelectedObject = new CustomHolder(obj); } -- Only #5 so far has done anything worthwhile: In the property grid as a single field I get what looks like str(obj) output: I've also considered using the TypeDescriptor() class/methods to create each property grid entry myself, but I don't see anything at all about where PropertyGrid gets its property fields from -- see #4. Is there any way to do this conveniently (I'd prefer not to write a C# custom dll, but am amiable to the requirement of doing so)? Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From rpigneri at LavaStorm.com Wed Apr 23 17:00:40 2008 From: rpigneri at LavaStorm.com (Pigneri, Rocco) Date: Wed, 23 Apr 2008 11:00:40 -0400 Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python objects In-Reply-To: <3290753a0804230631w73b143e8vf805902b96af26b6@mail.gmail.com> References: <3290753a0804230626h99a309ci975ad35dabcc2c35@mail.gmail.com> <3290753a0804230631w73b143e8vf805902b96af26b6@mail.gmail.com> Message-ID: Dear Charles, I ran into the same problem you are experiencing a few months ago while using Python 1.1. The problem is that the WinForms reflection is looking for static properties. IronPython 1.1 objects, being dynamic, lack the proper metadata to guide the WinForms classes to do the right thing. Try 1.1.1. That will allow WinForms to find a *whole* lot of things (including all your public methods). My guess is that it may be easier for you to turn off these extra elements rather than to create a separate C# assembly to hold static interfaces. It would be great to clean up these staticized properties in 1.1.2 to include only properties defined with the "property" function. That would really help anyone using static data binding in WinForms (or any other part of the BCL for that matter). Hope that helps, Rocco ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Charles Mason Sent: Wednesday, April 23, 2008 9:31 AM To: users at lists.ironpython.com Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python objects So I've been through hell last night tearing my hear out trying to figure out how to work PropertyGrid properly with a Python class object. Things I've tried: 1) In Python, PropertyGrid.SelectedObject = pythonobj 2) In Python, Deriving PropertyGrid and overriding CreatePropertyTab 3) In C#, deriving a new class from PropertyGrid and implementing public void SetPythonObject(Object obj) { this.SelectedObject = obj; } 4) In C#, Overriding CreatePropertyTab() (I get a warning about hiding a baseclass implementation -- sounds like this isn't overrideable) 5) In C#, creating a wrapper class: class CustomHolder { private Object heldObj = null; public Object held { get { return heldObj; } set { heldObj = value; } } CustomHolder(Object obj) { this.held = obj; } } and in the derived PropertyGrid class: public void SetPythonObject(Object obj) { this.SelectedObject = new CustomHolder(obj); } -- Only #5 so far has done anything worthwhile: In the property grid as a single field I get what looks like str(obj) output: I've also considered using the TypeDescriptor() class/methods to create each property grid entry myself, but I don't see anything at all about where PropertyGrid gets its property fields from -- see #4. Is there any way to do this conveniently (I'd prefer not to write a C# custom dll, but am amiable to the requirement of doing so)? Chuck -------------- next part -------------- An HTML attachment was scrubbed... URL: From william at resolversystems.com Wed Apr 23 16:59:12 2008 From: william at resolversystems.com (William Reade) Date: Wed, 23 Apr 2008 15:59:12 +0100 Subject: [IronPython] Ironclad v0.2 released Message-ID: <480F4EC0.1010208@resolversystems.com> Hi all Please enjoy Ironclad v0.2, which is now available from: http://code.google.com/p/ironclad/downloads/list Major changes are as follows: * Ironclad now uses IronPython 2.0b1 for everything. * It is now possible to use all the functions and types -- and their methods -- from the bz2 module. Major deficiencies are as follows: * Lists are not well mapped -- changes made on one side of the managed/unmanaged divide will not necessarily be seen on the other. * Type members and properties don't work yet. * Most of the CPython API is still not implemented. The next steps are to make attributes and properties work, and then to start work on the multiarray module from numpy. Best regards william From cemasoniv at gmail.com Wed Apr 23 17:25:57 2008 From: cemasoniv at gmail.com (Charles Mason) Date: Wed, 23 Apr 2008 11:25:57 -0400 Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python objects In-Reply-To: References: <3290753a0804230626h99a309ci975ad35dabcc2c35@mail.gmail.com> <3290753a0804230631w73b143e8vf805902b96af26b6@mail.gmail.com> Message-ID: <3290753a0804230825i923417aq8b590c67c842400b@mail.gmail.com> I should have mentioned that I am indeed using IronPython 1.1.1. >From what I can tell the objects are working very nicely with WinForms with the exception of PropertyGrid. Were you using Propertygrid specifically? C On Wed, Apr 23, 2008 at 11:00 AM, Pigneri, Rocco wrote: > Dear Charles, > > I ran into the same problem you are experiencing a few months ago while > using Python 1.1. The problem is that the WinForms reflection is looking > for static properties. IronPython 1.1 objects, being dynamic, lack the > proper metadata to guide the WinForms classes to do the right thing. > > Try 1.1.1. That will allow WinForms to find a *whole* lot of things > (including all your public methods). My guess is that it may be easier for > you to turn off these extra elements rather than to create a separate C# > assembly to hold static interfaces. > > It would be great to clean up these staticized properties in 1.1.2 to > include only properties defined with the "property" function. That would > really help anyone using static data binding in WinForms (or any other part > of the BCL for that matter). > > Hope that helps, > > Rocco > > ------------------------------ > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Charles Mason > *Sent:* Wednesday, April 23, 2008 9:31 AM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] System.Windows.Forms.PropertyGrid and Python > objects > > So I've been through hell last night tearing my hear out trying to figure > out how to work PropertyGrid properly with a Python class object. > > Things I've tried: > > 1) In Python, PropertyGrid.SelectedObject = pythonobj > 2) In Python, Deriving PropertyGrid and overriding CreatePropertyTab > 3) In C#, deriving a new class from PropertyGrid and implementing > > public void SetPythonObject(Object obj) > { > this.SelectedObject = obj; > } > > > 4) In C#, Overriding CreatePropertyTab() (I get a warning about hiding a > baseclass implementation -- sounds like this isn't overrideable) > 5) In C#, creating a wrapper class: > > class CustomHolder > { > private Object heldObj = null; > public Object held { > get { return heldObj; } > set { heldObj = value; } > } > CustomHolder(Object obj) > { > this.held = obj; > } > } > > and in the derived PropertyGrid class: > > public void SetPythonObject(Object obj) > { > this.SelectedObject = new CustomHolder(obj); > } > > -- > > Only #5 so far has done anything worthwhile: In the property grid as a > single field I get what looks like str(obj) output: > > > I've also considered using the TypeDescriptor() class/methods to create > each property grid entry myself, but I don't see anything at all about where > PropertyGrid gets its property fields from -- see #4. > > Is there any way to do this conveniently (I'd prefer not to write a C# > custom dll, but am amiable to the requirement of doing so)? > > Chuck > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christopher.masters at credit-suisse.com Wed Apr 23 17:30:04 2008 From: christopher.masters at credit-suisse.com (Masters, Christopher) Date: Wed, 23 Apr 2008 16:30:04 +0100 Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python obj ects Message-ID: <8C984B4799C04D4B8F80F746537145E11EA49D30@elon12p32001.csfp.co.uk> Is it related to this? http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13405 _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Charles Mason Sent: 23 April 2008 16:26 To: Discussion of IronPython Subject: Re: [IronPython] System.Windows.Forms.PropertyGrid and Python objects I should have mentioned that I am indeed using IronPython 1.1.1. >From what I can tell the objects are working very nicely with WinForms with the exception of PropertyGrid. Were you using Propertygrid specifically? C On Wed, Apr 23, 2008 at 11:00 AM, Pigneri, Rocco > wrote: Dear Charles, I ran into the same problem you are experiencing a few months ago while using Python 1.1. The problem is that the WinForms reflection is looking for static properties. IronPython 1.1 objects, being dynamic, lack the proper metadata to guide the WinForms classes to do the right thing. Try 1.1.1. That will allow WinForms to find a *whole* lot of things (including all your public methods). My guess is that it may be easier for you to turn off these extra elements rather than to create a separate C# assembly to hold static interfaces. It would be great to clean up these staticized properties in 1.1.2 to include only properties defined with the "property" function. That would really help anyone using static data binding in WinForms (or any other part of the BCL for that matter). Hope that helps, Rocco _____ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com ] On Behalf Of Charles Mason Sent: Wednesday, April 23, 2008 9:31 AM To: users at lists.ironpython.com Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python objects So I've been through hell last night tearing my hear out trying to figure out how to work PropertyGrid properly with a Python class object. Things I've tried: 1) In Python, PropertyGrid.SelectedObject = pythonobj 2) In Python, Deriving PropertyGrid and overriding CreatePropertyTab 3) In C#, deriving a new class from PropertyGrid and implementing public void SetPythonObject(Object obj) { this.SelectedObject = obj; } 4) In C#, Overriding CreatePropertyTab() (I get a warning about hiding a baseclass implementation -- sounds like this isn't overrideable) 5) In C#, creating a wrapper class: class CustomHolder { private Object heldObj = null; public Object held { get { return heldObj; } set { heldObj = value; } } CustomHolder(Object obj) { this.held = obj; } } and in the derived PropertyGrid class: public void SetPythonObject(Object obj) { this.SelectedObject = new CustomHolder(obj); } -- Only #5 so far has done anything worthwhile: In the property grid as a single field I get what looks like str(obj) output: I've also considered using the TypeDescriptor() class/methods to create each property grid entry myself, but I don't see anything at all about where PropertyGrid gets its property fields from -- see #4. Is there any way to do this conveniently (I'd prefer not to write a C# custom dll, but am amiable to the requirement of doing so)? Chuck _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: From cemasoniv at gmail.com Wed Apr 23 17:52:08 2008 From: cemasoniv at gmail.com (Charles Mason) Date: Wed, 23 Apr 2008 11:52:08 -0400 Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python obj ects In-Reply-To: <8C984B4799C04D4B8F80F746537145E11EA49D30@elon12p32001.csfp.co.uk> References: <8C984B4799C04D4B8F80F746537145E11EA49D30@elon12p32001.csfp.co.uk> Message-ID: <3290753a0804230852n20871661t77abe2eb877f3b57@mail.gmail.com> Yes. It's the only article that's worth reading that google turned up. On Wed, Apr 23, 2008 at 11:30 AM, Masters, Christopher < christopher.masters at credit-suisse.com> wrote: > Is it related to this? > > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13405 > > > ------------------------------ > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Charles Mason > *Sent:* 23 April 2008 16:26 > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] System.Windows.Forms.PropertyGrid and Python > objects > > I should have mentioned that I am indeed using IronPython 1.1.1. > > From what I can tell the objects are working very nicely with WinForms with > the exception of PropertyGrid. > > Were you using Propertygrid specifically? > > C > > On Wed, Apr 23, 2008 at 11:00 AM, Pigneri, Rocco > wrote: > >> Dear Charles, >> >> I ran into the same problem you are experiencing a few months ago while >> using Python 1.1. The problem is that the WinForms reflection is looking >> for static properties. IronPython 1.1 objects, being dynamic, lack the >> proper metadata to guide the WinForms classes to do the right thing. >> >> Try 1.1.1. That will allow WinForms to find a *whole* lot of things >> (including all your public methods). My guess is that it may be easier for >> you to turn off these extra elements rather than to create a separate C# >> assembly to hold static interfaces. >> >> It would be great to clean up these staticized properties in 1.1.2 to >> include only properties defined with the "property" function. That would >> really help anyone using static data binding in WinForms (or any other part >> of the BCL for that matter). >> >> Hope that helps, >> >> Rocco >> >> ------------------------------ >> *From:* users-bounces at lists.ironpython.com [mailto: >> users-bounces at lists.ironpython.com] *On Behalf Of *Charles Mason >> *Sent:* Wednesday, April 23, 2008 9:31 AM >> *To:* users at lists.ironpython.com >> *Subject:* [IronPython] System.Windows.Forms.PropertyGrid and Python >> objects >> >> So I've been through hell last night tearing my hear out trying to >> figure out how to work PropertyGrid properly with a Python class object. >> >> Things I've tried: >> >> 1) In Python, PropertyGrid.SelectedObject = pythonobj >> 2) In Python, Deriving PropertyGrid and overriding CreatePropertyTab >> 3) In C#, deriving a new class from PropertyGrid and implementing >> >> public void SetPythonObject(Object obj) >> { >> this.SelectedObject = obj; >> } >> >> >> 4) In C#, Overriding CreatePropertyTab() (I get a warning about hiding a >> baseclass implementation -- sounds like this isn't overrideable) >> 5) In C#, creating a wrapper class: >> >> class CustomHolder >> { >> private Object heldObj = null; >> public Object held { >> get { return heldObj; } >> set { heldObj = value; } >> } >> CustomHolder(Object obj) >> { >> this.held = obj; >> } >> } >> >> and in the derived PropertyGrid class: >> >> public void SetPythonObject(Object obj) >> { >> this.SelectedObject = new CustomHolder(obj); >> } >> >> -- >> >> Only #5 so far has done anything worthwhile: In the property grid as a >> single field I get what looks like str(obj) output: >> >> >> I've also considered using the TypeDescriptor() class/methods to create >> each property grid entry myself, but I don't see anything at all about where >> PropertyGrid gets its property fields from -- see #4. >> >> Is there any way to do this conveniently (I'd prefer not to write a C# >> custom dll, but am amiable to the requirement of doing so)? >> >> Chuck >> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > ============================================================================== > Please access the attached hyperlink for an important electronic communications disclaimer: > http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html > ============================================================================== > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Wed Apr 23 17:52:31 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 23 Apr 2008 08:52:31 -0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: References: Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD801F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Yikes, this is a scary bug... This is related to COM and STA threads even though you're not using COM! I might get some of this analysis wrong I think I understand basically what's happening. The main thread of all Python apps is an STA thread. This enables things like WinForms to work from a .py script. It also enables other things like starting processes which use shell execute - all shell APIs require to be called on an STA thread. We used to have an option, and it will be coming back, -X:MTA which would force an app to start it's "main thread" in MTA mode. It looks like the CLR is remembering that some object it has created were in fact created on an STA thread and therefore the finalizer needs to run on the STA thread as well. So the CLR finalizer thread is blocked trying to get back to the STA thread. Meanwhile you're sitting in a loop which is doing GC collections and a Thread.Sleep. This prevents the CLR from ever getting back to the STA thread because it is not pumping messages. So obviously one impractical solution is to pass the non-existent -X:MTA option :). Another solution is to ensure that you pump messages. The easiest way to do that in your sample code below is Thread.CurrentThread.Join(100) instead of doing a Thread.Sleep(100). The join will continue to pump messages while waiting for the current thread to exit. That will time out of course because it's waiting on its self so it'll behave just like a sleep. Anyway I've opened a bug to track this: http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=16249 We at the very least need to bring back -X:MTA. You could also imagine us doing something useful like warning when you call Thread.Sleep - but first I need to implement warning support :). Finally we could see if we could avoid creating the object which has to be finalizable on an STA thread but that might be more of a challenge - I'm not even sure what object it is. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sakesun Roykiattisak Sent: Wednesday, April 23, 2008 12:23 AM To: users at lists.ironpython.com Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? Hi, My today attempt to fight with over-memory usage in my IronPython server application, reveal a very strange behavior of IronPython (both 1.1 and 2.0b) I'll demonstrate with the following script: "loopit.py" ##### loopit.py ########################### import clr #clr.AddReference('System') class MyObj(object): def __del__(self): print 'gone' def run(): from System.Threading import Thread from System import GC while True: MyObj() Thread.Sleep(100) GC.Collect() run() ########################################### try to run this script you'll see a stream of 'gone' print out. However, if you uncomment the line "clr.AddReference('System')" and rerun it again the system will simple halt, memory usage will keep raising. Until you press Ctrl-C, then the you will see the pending 'gone' stream out. I've tried with clr.AddReference('System.Data') clr.AddReference('System.Xml') and the behaviour is the same for any Assembly. This is really weird. Why should clr.AddReference effect how GC work ? And I believe this is indeed the true source of memory problem I'm facing. Hope someone explain me why. Thanks From dinov at exchange.microsoft.com Wed Apr 23 18:02:15 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Wed, 23 Apr 2008 09:02:15 -0700 Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python obj ects In-Reply-To: <3290753a0804230852n20871661t77abe2eb877f3b57@mail.gmail.com> References: <8C984B4799C04D4B8F80F746537145E11EA49D30@elon12p32001.csfp.co.uk> <3290753a0804230852n20871661t77abe2eb877f3b57@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD8027@DF-GRTDANE-MSG.exchange.corp.microsoft.com> If it is that conversion issue I actually think we might be able to fix it. We do have a Converter.CanConvertFrom method and I'm not sure why we're not calling that instead of creating an instance and calling TryConvert. It should be a relatively easy fix so I've raised the priority to high but I'd also encourage voting on the bug. From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Charles Mason Sent: Wednesday, April 23, 2008 8:52 AM To: Discussion of IronPython Subject: Re: [IronPython] System.Windows.Forms.PropertyGrid and Python obj ects Yes. It's the only article that's worth reading that google turned up. On Wed, Apr 23, 2008 at 11:30 AM, Masters, Christopher > wrote: Is it related to this? http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13405 ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Charles Mason Sent: 23 April 2008 16:26 To: Discussion of IronPython Subject: Re: [IronPython] System.Windows.Forms.PropertyGrid and Python objects I should have mentioned that I am indeed using IronPython 1.1.1. >From what I can tell the objects are working very nicely with WinForms with the exception of PropertyGrid. Were you using Propertygrid specifically? C On Wed, Apr 23, 2008 at 11:00 AM, Pigneri, Rocco > wrote: Dear Charles, I ran into the same problem you are experiencing a few months ago while using Python 1.1. The problem is that the WinForms reflection is looking for static properties. IronPython 1.1 objects, being dynamic, lack the proper metadata to guide the WinForms classes to do the right thing. Try 1.1.1. That will allow WinForms to find a *whole* lot of things (including all your public methods). My guess is that it may be easier for you to turn off these extra elements rather than to create a separate C# assembly to hold static interfaces. It would be great to clean up these staticized properties in 1.1.2 to include only properties defined with the "property" function. That would really help anyone using static data binding in WinForms (or any other part of the BCL for that matter). Hope that helps, Rocco ________________________________ From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Charles Mason Sent: Wednesday, April 23, 2008 9:31 AM To: users at lists.ironpython.com Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python objects So I've been through hell last night tearing my hear out trying to figure out how to work PropertyGrid properly with a Python class object. Things I've tried: 1) In Python, PropertyGrid.SelectedObject = pythonobj 2) In Python, Deriving PropertyGrid and overriding CreatePropertyTab 3) In C#, deriving a new class from PropertyGrid and implementing public void SetPythonObject(Object obj) { this.SelectedObject = obj; } 4) In C#, Overriding CreatePropertyTab() (I get a warning about hiding a baseclass implementation -- sounds like this isn't overrideable) 5) In C#, creating a wrapper class: class CustomHolder { private Object heldObj = null; public Object held { get { return heldObj; } set { heldObj = value; } } CustomHolder(Object obj) { this.held = obj; } } and in the derived PropertyGrid class: public void SetPythonObject(Object obj) { this.SelectedObject = new CustomHolder(obj); } -- Only #5 so far has done anything worthwhile: In the property grid as a single field I get what looks like str(obj) output: I've also considered using the TypeDescriptor() class/methods to create each property grid entry myself, but I don't see anything at all about where PropertyGrid gets its property fields from -- see #4. Is there any way to do this conveniently (I'd prefer not to write a C# custom dll, but am amiable to the requirement of doing so)? Chuck _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ============================================================================== _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From curt at hagenlocher.org Wed Apr 23 17:58:18 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 23 Apr 2008 08:58:18 -0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: <7AD436E4270DD54A94238001769C22270126F9FD801F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C22270126F9FD801F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: On Wed, Apr 23, 2008 at 8:52 AM, Dino Viehland wrote: > > Another solution is to ensure that you pump messages. The easiest way > to do that in your sample code below is Thread.CurrentThread.Join(100) > instead of doing a Thread.Sleep(100). You could probably also do a GC.WaitForPendingFinalizers, which should allow any pending finalizers to be run. __del__ methods aren't nearly as useful in IronPython as they are in CPython due to the nature of non-deterministic finalization. -- Curt Hagenlocher curt at hagenlocher.org From curt at hagenlocher.org Wed Apr 23 17:59:42 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 23 Apr 2008 08:59:42 -0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: References: <7AD436E4270DD54A94238001769C22270126F9FD801F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: On Wed, Apr 23, 2008 at 8:58 AM, Curt Hagenlocher wrote: > You could probably also do a GC.WaitForPendingFinalizers, which should > allow any pending finalizers to be run. Never mind, that's bad advice and won't work :). -- Curt Hagenlocher curt at hagenlocher.org From curt at hagenlocher.org Wed Apr 23 20:39:33 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 23 Apr 2008 11:39:33 -0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: References: Message-ID: On Wed, Apr 23, 2008 at 12:23 AM, Sakesun Roykiattisak wrote: > > However, if you uncomment the line "clr.AddReference('System')" > and rerun it again the system will simple halt, memory usage > will keep raising. I've been playing with this a bit while waiting for builds to finish today, and I found some interesting things: 1. If you try to add a reference to a non-existent assembly, the problem still happens. Replace your clr.AddReference with the following to demonstrate this: try: clr.AddReference('System89') except: pass 2. If you add a reference with a strong name, the problem does *not* happen. Replace your clr.AddReference with the following to demonstrate this: clr.AddReference('System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') The primary difference between the two is that the former results in a call to both Assembly.Load and Assembly.LoadWithPartialName -- each of which trigger the AssemblyResolve event on the AppDomain -- while the latter is resolved by Assembly.Load without ever firing AssemblyResolve. -- Curt Hagenlocher curt at hagenlocher.org From curt at hagenlocher.org Thu Apr 24 01:44:46 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 23 Apr 2008 16:44:46 -0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: References: Message-ID: On Wed, Apr 23, 2008 at 12:23 AM, Sakesun Roykiattisak wrote: > > My today attempt to fight with over-memory usage in my IronPython > server application, reveal a very strange behavior of IronPython > (both 1.1 and 2.0b) I'll demonstrate with the following script: "loopit.py" This is actually a really fun testbed for examining the behavior of the finalizer queue in the face of various conditions. After a bit more trial and error, I've got a theory for what happens. clr.AddReference('System') does something which creates a short-lived COM object that was nonetheless briefly accessible through the CLR. When garbage is next collected, this object has no references left. It's got a finalizer, though, because it's a COM object and someone needs to make that last call to IUnknown::Release. But because it was created from a single-threaded apartment, the GC won't schedule the finalizer to be run while the apartment from which it was created is unavailable. Somehow -- maybe just because the finalization queue literally is a queue -- no other finalizer can be run while the system is waiting to run this one. In the original example, if you "GC.Collect()" and "Thread.CurrentThread.Join()" immediately after the call to clr.AddReference, you force finalization of this COM object and any remaining finalization happens normally as subsequent calls to GC.Collect() are made. If this theory is roughly correct, then the same problem can be triggered by just about any code that inadvertently calls CoCreateInstance from an STA thread. This would include use of the WebClient and SqlClient classes, iirc. And in that sense, it's not an IronPython problem at all, though it's exacerbated by the fact that the IP console is STA "by default". -- Curt Hagenlocher curt at hagenlocher.org From sakesun at boonthavorn.com Thu Apr 24 03:57:41 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Thu, 24 Apr 2008 08:57:41 +0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: References: Message-ID: Curt, > 2. If you add a reference with a strong name, the problem does *not* > happen. Aha ! You save my day again. In my application, 'System.Data' and 'System.Xml' is all I need. My stateless Appserver is now staticly consume < 120 MB of memory. As for more hints on this bug, I've found neither "clr.AddReference('IronPython')" nor "clr.AddReferenceToFileAndPath" cause any harm. Thanks. From sakesun at boonthavorn.com Thu Apr 24 04:09:59 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Thu, 24 Apr 2008 09:09:59 +0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: <7AD436E4270DD54A94238001769C22270126F9FD801F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <7AD436E4270DD54A94238001769C22270126F9FD801F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: On Wed, 23 Apr 2008 22:52:31 +0700, Dino Viehland wrote: > So obviously one impractical solution is to pass the non-existent -X:MTA > option :). Another solution is to ensure that you pump messages. The > easiest way to do that in your sample code below is > Thread.CurrentThread.Join(100) instead of doing a Thread.Sleep(100). > The join will continue to pump messages while waiting for the current > thread to exit. That will time out of course because it's waiting on > its self so it'll behave just like a sleep. Yeah, that's work. Do not fully understand what you're talking about (I'm basically a database application developer) But I wish you luck on fixing it. :) As for 2.0b, I've found it break many of my application test-cases. Mostly, relate to CLR interop. But I'm yet to find way to extract and reproduce the bug without submitting my whole working set. Looking forward to see beta2 soon. Thanks. From maxyaffe at comcast.net Thu Apr 24 04:34:41 2008 From: maxyaffe at comcast.net (Max R. Yaffe) Date: Wed, 23 Apr 2008 22:34:41 -0400 Subject: [IronPython] IP2, DLR & Windows.Forms Message-ID: <20080424023439.DEFAA48002@diego.dreamhost.com> Hello IronPythonistas, Will the DLR + IP2 combo support Windows Forms applications, i.e. can I build a combined C# and IP2 application using DLR and Windows Forms? I'm not a fan of WPF and XAML but can live with in a C#/Windows Forms world. Thanks, Max From curt at hagenlocher.org Thu Apr 24 04:39:52 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Wed, 23 Apr 2008 19:39:52 -0700 Subject: [IronPython] IP2, DLR & Windows.Forms In-Reply-To: <20080424023439.DEFAA48002@diego.dreamhost.com> References: <20080424023439.DEFAA48002@diego.dreamhost.com> Message-ID: On Wed, Apr 23, 2008 at 7:34 PM, Max R. Yaffe wrote: > > Will the DLR + IP2 combo support Windows Forms applications, i.e. can I > build a combined C# and IP2 application using DLR and Windows Forms? I'm > not a fan of WPF and XAML but can live with in a C#/Windows Forms world. Have you seen the Windows Forms samples in the IronPython Cookbook? http://www.ironpython.info/index.php/Contents#Windows_Forms -- Curt Hagenlocher curt at hagenlocher.org From sakesun at boonthavorn.com Thu Apr 24 05:43:19 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Thu, 24 Apr 2008 10:43:19 +0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: References: Message-ID: > In the original example, if you "GC.Collect()" and > "Thread.CurrentThread.Join()" immediately after the call to > clr.AddReference, you force finalization of this COM object and any > remaining finalization happens normally as subsequent calls to > GC.Collect() are made. Yes. This works too. I've change all my clr.AddReference(xxx) to my_addref(xxx) def my_addref(name): import clr from System import GC from System.Threading import Thread clr.AddReference(name) GC.Collect() Thread.CurrentThread.Join(0) Probably this is the easiest way to fix #16249 From lists.ironpython.com at ka.weltenschmiede.com Thu Apr 24 12:33:23 2008 From: lists.ironpython.com at ka.weltenschmiede.com (Korbinian Abenthum) Date: Thu, 24 Apr 2008 12:33:23 +0200 Subject: [IronPython] DefaultParameterValue for keyword arguments Message-ID: <002201c8a5f6_9fc2a2d0_52f8fea9@lannisport> Hello I have a problem declaring a C# method with Nullable parameters having DefaultParameterValue attributes: public void SomeMethod([DefaultParameterValue(1f)] float f) { } //works public void SomeMethod([DefaultParameterValue(1f)] float? f) { } //fails public void SomeMethod([DefaultParameterValue(null)] int? i) { } //fails public void SomeMethod([DefaultParameterValue((byte?)1)] byte? f) { } //fails The second and third fail with Compiler Error CS1908: "The type of the argument to the DefaultValue attribute must match the parameter type", the last one with CS0182: "An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type" Is that a bug in the compiler that he doesn't recognize "1f" or "null" as valid values of "float?", or am I making a mistake? I realize that it's not exactly OT, but I guess that many IronPython users will use DefaultParameterValue attributes to get nice pythonic C# methods exposed to IronPython, and maybe one of you has already encountered this problem? Best regards, Korbinian From cemasoniv at gmail.com Thu Apr 24 16:00:49 2008 From: cemasoniv at gmail.com (Charles Mason) Date: Thu, 24 Apr 2008 10:00:49 -0400 Subject: [IronPython] System.Windows.Forms.PropertyGrid and Python objects (Solution) Message-ID: <3290753a0804240700t14048ee1x6954b900f84a3f20@mail.gmail.com> At least temporary anyway. I've put my solution in mercurial: http://www.chelestra.com/hg/index.py/Chuck.Custom/file/36b285715130/Chuck.Custom/ Basically, I've inherited PropertyGrid and provided a "SetPythonObject" method (See CustomPropertyGrid). The Private object holder has a property with custom type converter on it that calls "GetProperties" on the given python object. In Python, I implement said method in its simplest case as: class MyObject: field = "name" def GetProperties(self): return TypeDescriptor.GetProperties(self) In actuality, though, I've done some filtering of properties so that I don't get all the nice pythony stuff. Works very nicely but I have come across a few more issues. Most notably I wanted the ability to nest objects like: class MyOtherObject: instance = MyObject() def GetProperties(self): return TypeDescriptor.GetProperties(self) This doesn't work out of the box, and is what the PublicCustomObjectHolder is for: simply derive from it and implement GetProperties. class MyObject(PublicCustomObjectHolder): field = "name" def GetProperties(self): return TypeDescriptor.GetProperties(self) class MyOtherObject(PublicCustomObjectHolder): instance = MyObject() def GetProperties(self): return TypeDescriptor.GetProperties(self) Calling PropertyGrid.SetPythonObject( MyOtherObject() ) now works as desired. Thanks to everyone for the hints. Perhaps this can be useful to someone? Chuck On Wed, Apr 23, 2008 at 12:02 PM, Dino Viehland < dinov at exchange.microsoft.com> wrote: > If it is that conversion issue I actually think we might be able to fix > it. We do have a Converter.CanConvertFrom method and I'm not sure why we're > not calling that instead of creating an instance and calling TryConvert. It > should be a relatively easy fix so I've raised the priority to high but I'd > also encourage voting on the bug. > > > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Charles Mason > *Sent:* Wednesday, April 23, 2008 8:52 AM > > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] System.Windows.Forms.PropertyGrid and Python > obj ects > > > > Yes. > > It's the only article that's worth reading that google turned up. > > On Wed, Apr 23, 2008 at 11:30 AM, Masters, Christopher < > christopher.masters at credit-suisse.com> wrote: > > Is it related to this? > > > > http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=13405 > > > > > ------------------------------ > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Charles Mason > > *Sent:* 23 April 2008 16:26 > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] System.Windows.Forms.PropertyGrid and Python > objects > > I should have mentioned that I am indeed using IronPython 1.1.1. > > >From what I can tell the objects are working very nicely with WinForms > with the exception of PropertyGrid. > > Were you using Propertygrid specifically? > > C > > On Wed, Apr 23, 2008 at 11:00 AM, Pigneri, Rocco > wrote: > > Dear Charles, > > > > I ran into the same problem you are experiencing a few months ago while > using Python 1.1. The problem is that the WinForms reflection is looking > for static properties. IronPython 1.1 objects, being dynamic, lack the > proper metadata to guide the WinForms classes to do the right thing. > > > > Try 1.1.1. That will allow WinForms to find a *whole* lot of things > (including all your public methods). My guess is that it may be easier for > you to turn off these extra elements rather than to create a separate C# > assembly to hold static interfaces. > > > > It would be great to clean up these staticized properties in 1.1.2 to > include only properties defined with the "property" function. That would > really help anyone using static data binding in WinForms (or any other part > of the BCL for that matter). > > > > Hope that helps, > > > > Rocco > > > ------------------------------ > > *From:* users-bounces at lists.ironpython.com [mailto: > users-bounces at lists.ironpython.com] *On Behalf Of *Charles Mason > *Sent:* Wednesday, April 23, 2008 9:31 AM > *To:* users at lists.ironpython.com > *Subject:* [IronPython] System.Windows.Forms.PropertyGrid and Python > objects > > So I've been through hell last night tearing my hear out trying to figure > out how to work PropertyGrid properly with a Python class object. > > Things I've tried: > > 1) In Python, PropertyGrid.SelectedObject = pythonobj > 2) In Python, Deriving PropertyGrid and overriding CreatePropertyTab > 3) In C#, deriving a new class from PropertyGrid and implementing > > public void SetPythonObject(Object obj) > { > this.SelectedObject = obj; > } > > > 4) In C#, Overriding CreatePropertyTab() (I get a warning about hiding a > baseclass implementation -- sounds like this isn't overrideable) > 5) In C#, creating a wrapper class: > > class CustomHolder > { > private Object heldObj = null; > public Object held { > get { return heldObj; } > set { heldObj = value; } > } > CustomHolder(Object obj) > { > this.held = obj; > } > } > > and in the derived PropertyGrid class: > > public void SetPythonObject(Object obj) > { > this.SelectedObject = new CustomHolder(obj); > } > > -- > > Only #5 so far has done anything worthwhile: In the property grid as a > single field I get what looks like str(obj) output: > > > I've also considered using the TypeDescriptor() class/methods to create > each property grid entry myself, but I don't see anything at all about where > PropertyGrid gets its property fields from -- see #4. > > Is there any way to do this conveniently (I'd prefer not to write a C# > custom dll, but am amiable to the requirement of doing so)? > > Chuck > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > ============================================================================== > > Please access the attached hyperlink for an important electronic communications disclaimer: > > > > http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html > > ============================================================================== > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dinov at exchange.microsoft.com Thu Apr 24 16:57:45 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 24 Apr 2008 07:57:45 -0700 Subject: [IronPython] DefaultParameterValue for keyword arguments In-Reply-To: <002201c8a5f6_9fc2a2d0_52f8fea9@lannisport> References: <002201c8a5f6_9fc2a2d0_52f8fea9@lannisport> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD8305@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Try using [Optional] instead. It lets you specify that an argument isn't required but doesn't require you to provide the default value - which in this case does appear to be impossible. Then when calling from IronPython you'll get a nullable w/o a value if the parameter isn't provided. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Korbinian Abenthum Sent: Thursday, April 24, 2008 3:33 AM To: Discussion of IronPython Subject: [IronPython] DefaultParameterValue for keyword arguments Hello I have a problem declaring a C# method with Nullable parameters having DefaultParameterValue attributes: public void SomeMethod([DefaultParameterValue(1f)] float f) { } //works public void SomeMethod([DefaultParameterValue(1f)] float? f) { } //fails public void SomeMethod([DefaultParameterValue(null)] int? i) { } //fails public void SomeMethod([DefaultParameterValue((byte?)1)] byte? f) { } //fails The second and third fail with Compiler Error CS1908: "The type of the argument to the DefaultValue attribute must match the parameter type", the last one with CS0182: "An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type" Is that a bug in the compiler that he doesn't recognize "1f" or "null" as valid values of "float?", or am I making a mistake? I realize that it's not exactly OT, but I guess that many IronPython users will use DefaultParameterValue attributes to get nice pythonic C# methods exposed to IronPython, and maybe one of you has already encountered this problem? Best regards, Korbinian _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Thu Apr 24 17:13:58 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Thu, 24 Apr 2008 08:13:58 -0700 Subject: [IronPython] clr.AddReference effect how GC work ?!?!?!? In-Reply-To: References: <7AD436E4270DD54A94238001769C22270126F9FD801F@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <7AD436E4270DD54A94238001769C22270126F9FD8308@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Amazingly if you want to understand a little more Raymond Chen posted a fairly appropriate blog entry this morning: http://blogs.msdn.com/oldnewthing/archive/2008/04/24/8420242.aspx Ok, it's more historical then technical, but still interesting. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sakesun Roykiattisak Sent: Wednesday, April 23, 2008 7:10 PM To: Discussion of IronPython Subject: Re: [IronPython] clr.AddReference effect how GC work ?!?!?!? On Wed, 23 Apr 2008 22:52:31 +0700, Dino Viehland wrote: > So obviously one impractical solution is to pass the non-existent -X:MTA > option :). Another solution is to ensure that you pump messages. The > easiest way to do that in your sample code below is > Thread.CurrentThread.Join(100) instead of doing a Thread.Sleep(100). > The join will continue to pump messages while waiting for the current > thread to exit. That will time out of course because it's waiting on > its self so it'll behave just like a sleep. Yeah, that's work. Do not fully understand what you're talking about (I'm basically a database application developer) But I wish you luck on fixing it. :) As for 2.0b, I've found it break many of my application test-cases. Mostly, relate to CLR interop. But I'm yet to find way to extract and reproduce the bug without submitting my whole working set. Looking forward to see beta2 soon. Thanks. _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Thu Apr 24 18:28:06 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Thu, 24 Apr 2008 17:28:06 +0100 Subject: [IronPython] #ironpython on irc.freenode.net Message-ID: <4810B516.2040500@voidspace.org.uk> Hello guys, I've just discovered there is an IronPython channel on irc.freenode.net - #ironpython It's pretty quiet - but as I am at home writing the book until next Friday I'm hanging out there, so come join me. :-) I'm currently writing on using IronPython from Powershell. I have a couple of examples, but if you have any ideas then let me know. :-) Michael http://www.ironpythoninaction.com/ From fuzzyman at voidspace.org.uk Fri Apr 25 16:51:16 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 25 Apr 2008 15:51:16 +0100 Subject: [IronPython] socket support in 1.1.2 Message-ID: <4811EFE4.7060605@voidspace.org.uk> Hello guys, We've got another user moaning that urllib and urllib2 don't work properly in Resolver One. This is because of outstanding bugs in IP 1.1.1 socket support. Can I make another plea for these to be resolved in 1.1.2. :-) Any timeline for an RC of 1.1.2? Thanks Michael Foord http://www.ironpythoninaction.com/ From fuzzyman at voidspace.org.uk Fri Apr 25 17:24:58 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 25 Apr 2008 16:24:58 +0100 Subject: [IronPython] socket support in 1.1.2 In-Reply-To: <4811EFE4.7060605@voidspace.org.uk> References: <4811EFE4.7060605@voidspace.org.uk> Message-ID: <4811F7CA.2010003@voidspace.org.uk> Uhm... just in case our customer subscribes to this list - I consider it an entirely *valid* moan. :-O Consider this a proxy-moan on behalf of all Resolver One users. :-) Michael Foord Michael Foord wrote: > Hello guys, > > We've got another user moaning that urllib and urllib2 don't work > properly in Resolver One. This is because of outstanding bugs in IP > 1.1.1 socket support. > > Can I make another plea for these to be resolved in 1.1.2. :-) > > Any timeline for an RC of 1.1.2? > > Thanks > > Michael Foord > http://www.ironpythoninaction.com/ > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From cjac at colliertech.org Fri Apr 25 18:02:24 2008 From: cjac at colliertech.org (CJ Adams-Collier) Date: Fri, 25 Apr 2008 09:02:24 -0700 Subject: [IronPython] How to use Tao.Glfw or Tao.OpenGL Zooming windows In-Reply-To: References: Message-ID: <1209139344.10706.96.camel@cjac.intra.cardomain.com> Hey there Jane, list, I'm one of the maintainers of the Tao project and took care of the Tao.OpenGl build system for a while. I'd love to see how well Tao operates on IronPython. Can you give me a rundown on what you've done so far? I find that discussion and support happens primarily on the Tao Framework forum: http://www.taoframework.com/forum If you'd like to see some examples of using Tao.OpenGl, feel free to check out the code in the C# binding of gtkglarea: http://anonsvn.mono-project.com/source/trunk/gtkglarea-sharp/examples/ This code is tested primarily on Mono/Debian, so it will probably not work "out of the box" on CLR/Windows. I'm happy to walk you through it and see if I can help you make it work, though! Cheers, C.J. On Sun, 2008-02-17 at 14:24 +0000, jane janet wrote: > > Hi all, > Me again. > I wanna know how to zoom my application windows using Tao framework. > I have no experience in this stuff. > Please tell me clearly. > > All the best, > > Jane > Jane > > > > > ______________________________________________________________________ > Helping your favorite cause is as easy as instant messaging. You IM, > we give. Learn more. > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From curt at hagenlocher.org Fri Apr 25 18:34:29 2008 From: curt at hagenlocher.org (Curt Hagenlocher) Date: Fri, 25 Apr 2008 09:34:29 -0700 Subject: [IronPython] socket support in 1.1.2 In-Reply-To: <4811F7CA.2010003@voidspace.org.uk> References: <4811EFE4.7060605@voidspace.org.uk> <4811F7CA.2010003@voidspace.org.uk> Message-ID: On Fri, Apr 25, 2008 at 8:24 AM, Michael Foord wrote: > Uhm... just in case our customer subscribes to this list - I consider it > an entirely *valid* moan. :-O Presumably, you would have said "whine" otherwise. Or "whinge", if they're in one of *those* parts of the world. :P I've attached a patch against 1.1.1 that (I think) fixes this. It works for my test case, anyway. -- Curt Hagenlocher curt at hagenlocher.org -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: socket.cs.diff URL: From tkapoor at wscm.net Fri Apr 25 18:36:31 2008 From: tkapoor at wscm.net (Tarun Kapoor) Date: Fri, 25 Apr 2008 11:36:31 -0500 Subject: [IronPython] socket support in 1.1.2 In-Reply-To: <4811EFE4.7060605@voidspace.org.uk> References: <4811EFE4.7060605@voidspace.org.uk> Message-ID: So that is what bosses think of their employees. Moaners, whiners etc .. and then post it on a mailing list -:) -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, April 25, 2008 9:51 AM To: Discussion of IronPython Subject: [IronPython] socket support in 1.1.2 Hello guys, We've got another user moaning that urllib and urllib2 don't work properly in Resolver One. This is because of outstanding bugs in IP 1.1.1 socket support. Can I make another plea for these to be resolved in 1.1.2. :-) Any timeline for an RC of 1.1.2? Thanks Michael Foord http://www.ironpythoninaction.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com Disclaimer This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with the sender. From fuzzyman at voidspace.org.uk Fri Apr 25 18:43:11 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 25 Apr 2008 17:43:11 +0100 Subject: [IronPython] socket support in 1.1.2 In-Reply-To: References: <4811EFE4.7060605@voidspace.org.uk> <4811F7CA.2010003@voidspace.org.uk> Message-ID: <48120A1F.1010004@voidspace.org.uk> Curt Hagenlocher wrote: > On Fri, Apr 25, 2008 at 8:24 AM, Michael Foord > wrote: > >> Uhm... just in case our customer subscribes to this list - I consider it >> an entirely *valid* moan. :-O >> > > Presumably, you would have said "whine" otherwise. Or "whinge", if > they're in one of *those* parts of the world. :P > > I've attached a patch against 1.1.1 that (I think) fixes this. It > works for my test case, anyway. > > We currently ship Microsoft binaries rather than compiling from source - so we'd rather wait for 1.1.2 than patch at this stage... but thanks. Michael > -- > Curt Hagenlocher > curt at hagenlocher.org > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From dinov at exchange.microsoft.com Fri Apr 25 19:45:51 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Fri, 25 Apr 2008 10:45:51 -0700 Subject: [IronPython] socket support in 1.1.2 In-Reply-To: <4811EFE4.7060605@voidspace.org.uk> References: <4811EFE4.7060605@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227012B209A4842@DF-GRTDANE-MSG.exchange.corp.microsoft.com> We're now thinking sometime in June for the RC. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Friday, April 25, 2008 7:51 AM To: Discussion of IronPython Subject: [IronPython] socket support in 1.1.2 Hello guys, We've got another user moaning that urllib and urllib2 don't work properly in Resolver One. This is because of outstanding bugs in IP 1.1.1 socket support. Can I make another plea for these to be resolved in 1.1.2. :-) Any timeline for an RC of 1.1.2? Thanks Michael Foord http://www.ironpythoninaction.com/ _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Fri Apr 25 20:26:50 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Fri, 25 Apr 2008 19:26:50 +0100 Subject: [IronPython] socket support in 1.1.2 In-Reply-To: <7AD436E4270DD54A94238001769C2227012B209A4842@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <4811EFE4.7060605@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227012B209A4842@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <4812226A.20904@voidspace.org.uk> Dino Viehland wrote: > We're now thinking sometime in June for the RC. > Ok - thanks. Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, April 25, 2008 7:51 AM > To: Discussion of IronPython > Subject: [IronPython] socket support in 1.1.2 > > Hello guys, > > We've got another user moaning that urllib and urllib2 don't work > properly in Resolver One. This is because of outstanding bugs in IP > 1.1.1 socket support. > > Can I make another plea for these to be resolved in 1.1.2. :-) > > Any timeline for an RC of 1.1.2? > > Thanks > > Michael Foord > http://www.ironpythoninaction.com/ > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From cjac at colliertech.org Fri Apr 25 22:41:53 2008 From: cjac at colliertech.org (CJ Adams-Collier) Date: Fri, 25 Apr 2008 13:41:53 -0700 Subject: [IronPython] How to use Tao.Glfw or Tao.OpenGL Zooming windows In-Reply-To: <47B8527A.4020006@defuze.org> References: <47B8527A.4020006@defuze.org> Message-ID: <1209156113.10706.103.camel@cjac.intra.cardomain.com> Hello again Jane, list, There's an example of zoom code in a quake model viewer I wrote in '01. It's C, though, and it was written by a 21-year-old, so I hope you don't mind your eyes bleeding... $ svn co http://svn.colliertech.org/svn/trunk/jenkara $ grep 'info->zoom' jenkara/src/*.c Cheers, C.J. On Sun, 2008-02-17 at 15:27 +0000, Sylvain Hellegouarch wrote: > Hi Jane, > > I'd say that you'll have to go through the Tao documentation [1] and get > a good OpenGL tutorial [2]. Note that the Tao distribution contains the > NeHe tutorial ported to C#. > > I don't remember much of my OpenGL years but I think zoom doesn't exist > per se, instead you change the view matrix. Have a look at [3]. > > - Sylvain > > [1] http://taoframework.com/project > [2] http://nehe.gamedev.net/ > [3] http://www.opengl.org/resources/faq/technical/viewing.htm > > jane janet a ?crit : > > > > Hi all, > > Me again. > > I wanna know how to zoom my application windows using Tao framework. > > I have no experience in this stuff. > > Please tell me clearly. > > > > All the best, > > > > Jane > > > > *Jane* > > > > > > ------------------------------------------------------------------------ > > Helping your favorite cause is as easy as instant messaging. You IM, > > we give. Learn more. > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From cjac at colliertech.org Fri Apr 25 22:43:43 2008 From: cjac at colliertech.org (CJ Adams-Collier) Date: Fri, 25 Apr 2008 13:43:43 -0700 Subject: [IronPython] How to use Tao.Glfw or Tao.OpenGL Zooming windows In-Reply-To: <47B87DC6.20706@defuze.org> References: <47B855DE.8080108@defuze.org> <47B87DC6.20706@defuze.org> Message-ID: <1209156223.10706.105.camel@cjac.intra.cardomain.com> There's another SDL wrapper that's more friendly, IIRC... Dylan, do you remember who was doing that? On Sun, 2008-02-17 at 18:32 +0000, Sylvain Hellegouarch wrote: > FYI, I took a couple of hours to write an example using TaoSDL on the > IronPython cookbook [1]. > > I wanted to notice that accessing attributes is not very smooth and I > assume it's due to the fac that TaoSDL structures are all unmanaged. Not > very foxy :) > > - Sylvain > > [1] http://www.ironpython.info/index.php/SDL_Zoom > > Sylvain Hellegouarch a ?crit : > > Jane, > > > > If you're only interested in 2D, you might want to use TaoSDL rather > > than TaoOpenGL+TaoGLFW. SDL is a pretty cool graphics library that runs > > on practically anything that exists. > > > > It might be easier than OpenGL but will only make sense in 2D context. > > > > For instance look at SdlGfx.zoomSurface from [1]. > > > > - Sylvain > > > > [1] http://docs.taoframework.com/Tao.Sdl/ > > > > jane janet a ?crit : > > > >> I forgot to tell you something. > >> My application window is 2 dimension. > >> I wanna zoom 2D windows. > >> > >> Best regards, > >> Jane > >> > >> > >> *Jane* > >> > >> > >> ------------------------------------------------------------------------ > >> Shed those extra pounds with MSN and The Biggest Loser! Learn more. > >> > >> ------------------------------------------------------------------------ > >> > >> _______________________________________________ > >> Users mailing list > >> Users at lists.ironpython.com > >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > >> > >> > > > > _______________________________________________ > > Users mailing list > > Users at lists.ironpython.com > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: From steve at holdenweb.com Fri Apr 25 23:47:04 2008 From: steve at holdenweb.com (Steve Holden) Date: Fri, 25 Apr 2008 17:47:04 -0400 Subject: [IronPython] socket support in 1.1.2 In-Reply-To: References: <4811EFE4.7060605@voidspace.org.uk> Message-ID: <48125158.6020108@holdenweb.com> Back in the 1980's at Sun that was referred to as a CLM (career-limiting move). regards Steve Tarun Kapoor wrote: > So that is what bosses think of their employees. Moaners, whiners etc .. > and then post it on a mailing list -:) > > -----Original Message----- > From: users-bounces at lists.ironpython.com > [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Friday, April 25, 2008 9:51 AM > To: Discussion of IronPython > Subject: [IronPython] socket support in 1.1.2 > > Hello guys, > > We've got another user moaning that urllib and urllib2 don't work > properly in Resolver One. This is because of outstanding bugs in IP > 1.1.1 socket support. > > Can I make another plea for these to be resolved in 1.1.2. :-) > > Any timeline for an RC of 1.1.2? > > Thanks > > Michael Foord > http://www.ironpythoninaction.com/ > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > Disclaimer > > This e-mail and any attachments is confidential and intended solely for the use of the individual(s) to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Waterstone Capital Management, L.P and affiliates. If you are not the intended recipient, be advised that you have received this e-mail in error and that any use, dissemination, printing, forwarding or copying of this email is strictly prohibited. Please contact the sender if you have received this e-mail in error. You should also be aware that e-mails are susceptible to interference and you should not assume that the contents of this e-mail originated from the sender above or that they have been accurately reproduced in their original form. Waterstone Capital Management, L.P. and affiliates accepts no responsibility for information, or errors or omissions in this e-mail or use or misuse thereof. If in doubt, please verify the authenticity with t he > sender. > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > . > -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ From sanxiyn at gmail.com Mon Apr 28 00:51:09 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Mon, 28 Apr 2008 07:51:09 +0900 Subject: [IronPython] Traceback regression Message-ID: <5b0248170804271551k46e22d3fk1c8de4e9ce954e22@mail.gmail.com> Traceback has regressed. import sys def f(): 1/0 try: f() except: tb = sys.exc_info()[2] while tb: print tb.tb_lineno tb = tb.tb_next CPython: 3 2 IronPython 1.1.1: 3 2 IronPython 2.0a5: 2 IronPython 2.0b1: (nothing) This is not 1.x->2.x regression. This is regression between 2.x series. -- Seo Sanghyeon From fuzzyman at voidspace.org.uk Mon Apr 28 01:09:52 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 28 Apr 2008 00:09:52 +0100 Subject: [IronPython] Traceback regression In-Reply-To: <5b0248170804271551k46e22d3fk1c8de4e9ce954e22@mail.gmail.com> References: <5b0248170804271551k46e22d3fk1c8de4e9ce954e22@mail.gmail.com> Message-ID: <481507C0.3020607@voidspace.org.uk> Sanghyeon Seo wrote: > Traceback has regressed. > Seo thinks this might actually now be fixed in the repository (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11116 is marked as closed in 2.0 Beta 2). If this *isn't* fixed it would be a major blocker for Resolver - it would prevent us providing accurate error messages to our users. All the best, Michael Foord http://www.ironpythoninaction.com/ > import sys > def f(): 1/0 > try: f() > except: tb = sys.exc_info()[2] > while tb: > print tb.tb_lineno > tb = tb.tb_next > > CPython: 3 2 > IronPython 1.1.1: 3 2 > IronPython 2.0a5: 2 > IronPython 2.0b1: (nothing) > > This is not 1.x->2.x regression. This is regression between 2.x series. > > From dinov at exchange.microsoft.com Mon Apr 28 01:14:35 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Sun, 27 Apr 2008 16:14:35 -0700 Subject: [IronPython] Traceback regression In-Reply-To: <481507C0.3020607@voidspace.org.uk> References: <5b0248170804271551k46e22d3fk1c8de4e9ce954e22@mail.gmail.com> <481507C0.3020607@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227012B27AD7590@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Yep, it's fixed and the tracebacks should now be better than they have ever been (even in 1.x). There were some small perf regressions from fixing it that I'm still working in resolving though - primarily around throwing additional overhead when throwing exceptions. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Sunday, April 27, 2008 4:10 PM To: Discussion of IronPython Subject: Re: [IronPython] Traceback regression Sanghyeon Seo wrote: > Traceback has regressed. > Seo thinks this might actually now be fixed in the repository (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11116 is marked as closed in 2.0 Beta 2). If this *isn't* fixed it would be a major blocker for Resolver - it would prevent us providing accurate error messages to our users. All the best, Michael Foord http://www.ironpythoninaction.com/ > import sys > def f(): 1/0 > try: f() > except: tb = sys.exc_info()[2] > while tb: > print tb.tb_lineno > tb = tb.tb_next > > CPython: 3 2 > IronPython 1.1.1: 3 2 > IronPython 2.0a5: 2 > IronPython 2.0b1: (nothing) > > This is not 1.x->2.x regression. This is regression between 2.x series. > > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Apr 28 01:21:20 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 28 Apr 2008 00:21:20 +0100 Subject: [IronPython] Traceback regression In-Reply-To: <7AD436E4270DD54A94238001769C2227012B27AD7590@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <5b0248170804271551k46e22d3fk1c8de4e9ce954e22@mail.gmail.com> <481507C0.3020607@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227012B27AD7590@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <48150A70.7020309@voidspace.org.uk> Dino Viehland wrote: > Yep, it's fixed and the tracebacks should now be better than they have ever been (even in 1.x). There were some small perf regressions from fixing it that I'm still working in resolving though - primarily around throwing additional overhead when throwing exceptions. > Cool. Seo only wasted a couple of hours fixing this for a FePy release of 2b1. :-) How did this regression slip past the IP test suite by the way? Michael > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, April 27, 2008 4:10 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Traceback regression > > Sanghyeon Seo wrote: > >> Traceback has regressed. >> >> > > Seo thinks this might actually now be fixed in the repository > (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11116 > is marked as closed in 2.0 Beta 2). > > If this *isn't* fixed it would be a major blocker for Resolver - it > would prevent us providing accurate error messages to our users. > > All the best, > > > Michael Foord > http://www.ironpythoninaction.com/ > > >> import sys >> def f(): 1/0 >> try: f() >> except: tb = sys.exc_info()[2] >> while tb: >> print tb.tb_lineno >> tb = tb.tb_next >> >> CPython: 3 2 >> IronPython 1.1.1: 3 2 >> IronPython 2.0a5: 2 >> IronPython 2.0b1: (nothing) >> >> This is not 1.x->2.x regression. This is regression between 2.x series. >> >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From dinov at exchange.microsoft.com Mon Apr 28 01:27:49 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Sun, 27 Apr 2008 16:27:49 -0700 Subject: [IronPython] Traceback regression In-Reply-To: <48150A70.7020309@voidspace.org.uk> References: <5b0248170804271551k46e22d3fk1c8de4e9ce954e22@mail.gmail.com> <481507C0.3020607@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227012B27AD7590@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <48150A70.7020309@voidspace.org.uk> Message-ID: <7AD436E4270DD54A94238001769C2227012B27AD7594@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Our traceback test was entirely disabled because of a few failures in it and we had bugs against the known failures. But the traceback support was allowed to regress more because none of the tests were running. Dave re-enabled the test recently w/ the specific tests disabled so that wouldn't continue to happen. Now that the bugs are fixed all the tests there are enabled again. We've also added a CPython side-by-side test which runs a huge number of combinations of flow control, exception handling, and exceptions being thrown which uncovered more issues which are also now fixed. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord Sent: Sunday, April 27, 2008 4:21 PM To: Discussion of IronPython Subject: Re: [IronPython] Traceback regression Dino Viehland wrote: > Yep, it's fixed and the tracebacks should now be better than they have ever been (even in 1.x). There were some small perf regressions from fixing it that I'm still working in resolving though - primarily around throwing additional overhead when throwing exceptions. > Cool. Seo only wasted a couple of hours fixing this for a FePy release of 2b1. :-) How did this regression slip past the IP test suite by the way? Michael > > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, April 27, 2008 4:10 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Traceback regression > > Sanghyeon Seo wrote: > >> Traceback has regressed. >> >> > > Seo thinks this might actually now be fixed in the repository > (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11116 > is marked as closed in 2.0 Beta 2). > > If this *isn't* fixed it would be a major blocker for Resolver - it > would prevent us providing accurate error messages to our users. > > All the best, > > > Michael Foord > http://www.ironpythoninaction.com/ > > >> import sys >> def f(): 1/0 >> try: f() >> except: tb = sys.exc_info()[2] >> while tb: >> print tb.tb_lineno >> tb = tb.tb_next >> >> CPython: 3 2 >> IronPython 1.1.1: 3 2 >> IronPython 2.0a5: 2 >> IronPython 2.0b1: (nothing) >> >> This is not 1.x->2.x regression. This is regression between 2.x series. >> >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From fuzzyman at voidspace.org.uk Mon Apr 28 01:35:18 2008 From: fuzzyman at voidspace.org.uk (Michael Foord) Date: Mon, 28 Apr 2008 00:35:18 +0100 Subject: [IronPython] Traceback regression In-Reply-To: <7AD436E4270DD54A94238001769C2227012B27AD7594@DF-GRTDANE-MSG.exchange.corp.microsoft.com> References: <5b0248170804271551k46e22d3fk1c8de4e9ce954e22@mail.gmail.com> <481507C0.3020607@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227012B27AD7590@DF-GRTDANE-MSG.exchange.corp.microsoft.com> <48150A70.7020309@voidspace.org.uk> <7AD436E4270DD54A94238001769C2227012B27AD7594@DF-GRTDANE-MSG.exchange.corp.microsoft.com> Message-ID: <48150DB6.508@voidspace.org.uk> Dino Viehland wrote: > Our traceback test was entirely disabled because of a few failures in it and we had bugs against the known failures. But the traceback support was allowed to regress more because none of the tests were running. Dave re-enabled the test recently w/ the specific tests disabled so that wouldn't continue to happen. > > Now that the bugs are fixed all the tests there are enabled again. We've also added a CPython side-by-side test which runs a huge number of combinations of flow control, exception handling, and exceptions being thrown which uncovered more issues which are also now fixed. > We'll let you off then. :-) Michael > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord > Sent: Sunday, April 27, 2008 4:21 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Traceback regression > > Dino Viehland wrote: > >> Yep, it's fixed and the tracebacks should now be better than they have ever been (even in 1.x). There were some small perf regressions from fixing it that I'm still working in resolving though - primarily around throwing additional overhead when throwing exceptions. >> >> > > Cool. Seo only wasted a couple of hours fixing this for a FePy release > of 2b1. :-) > > How did this regression slip past the IP test suite by the way? > > Michael > > >> -----Original Message----- >> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord >> Sent: Sunday, April 27, 2008 4:10 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] Traceback regression >> >> Sanghyeon Seo wrote: >> >> >>> Traceback has regressed. >>> >>> >>> >> Seo thinks this might actually now be fixed in the repository >> (http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=11116 >> is marked as closed in 2.0 Beta 2). >> >> If this *isn't* fixed it would be a major blocker for Resolver - it >> would prevent us providing accurate error messages to our users. >> >> All the best, >> >> >> Michael Foord >> http://www.ironpythoninaction.com/ >> >> >> >>> import sys >>> def f(): 1/0 >>> try: f() >>> except: tb = sys.exc_info()[2] >>> while tb: >>> print tb.tb_lineno >>> tb = tb.tb_next >>> >>> CPython: 3 2 >>> IronPython 1.1.1: 3 2 >>> IronPython 2.0a5: 2 >>> IronPython 2.0b1: (nothing) >>> >>> This is not 1.x->2.x regression. This is regression between 2.x series. >>> >>> >>> >>> >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> _______________________________________________ >> Users mailing list >> Users at lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > From sanxiyn at gmail.com Tue Apr 29 03:37:00 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Tue, 29 Apr 2008 10:37:00 +0900 Subject: [IronPython] IronPython and nose Message-ID: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> nose is a popular testing framework for Python. http://code.google.com/p/python-nose/ Current SVN trunk *almost* works with IronPython 1.1.1. I filed an issue to nose project's issue tracker for remaining problems. http://code.google.com/p/python-nose/issues/detail?id=183 Then I realized that it is using os.access implemented in FePy patch, not in official IronPython. Too bad! So if any of you want to use nose with IronPython, please go vote CodePlex #8073. http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=8073 -- Seo Sanghyeon From dinov at exchange.microsoft.com Tue Apr 29 03:43:14 2008 From: dinov at exchange.microsoft.com (Dino Viehland) Date: Mon, 28 Apr 2008 18:43:14 -0700 Subject: [IronPython] IronPython and nose In-Reply-To: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> References: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> Message-ID: <7AD436E4270DD54A94238001769C2227012B27AD788E@DF-GRTDANE-MSG.exchange.corp.microsoft.com> In one of my enlistments I have a fix for 8073 and it'd be trivial to back-port it to 1.1.2. I'll add it to the list. I've been meaning to open issues w/ the release set to 1.1.2 for all the bugs on CodePlex we want to backport. Unfortunately I just haven't gotten around to it yet but will soon. I think the fix for issue 183 has one too many "=="s and one too few "in"s though. -----Original Message----- From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Sanghyeon Seo Sent: Monday, April 28, 2008 6:37 PM To: Discussion of IronPython Subject: [IronPython] IronPython and nose nose is a popular testing framework for Python. http://code.google.com/p/python-nose/ Current SVN trunk *almost* works with IronPython 1.1.1. I filed an issue to nose project's issue tracker for remaining problems. http://code.google.com/p/python-nose/issues/detail?id=183 Then I realized that it is using os.access implemented in FePy patch, not in official IronPython. Too bad! So if any of you want to use nose with IronPython, please go vote CodePlex #8073. http://www.codeplex.com/IronPython/WorkItem/View.aspx?WorkItemId=8073 -- Seo Sanghyeon _______________________________________________ Users mailing list Users at lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From sakesun at boonthavorn.com Tue Apr 29 03:44:31 2008 From: sakesun at boonthavorn.com (Sakesun Roykiattisak) Date: Tue, 29 Apr 2008 08:44:31 +0700 Subject: [IronPython] IronPython and nose In-Reply-To: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> References: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> Message-ID: > Current SVN trunk *almost* works with IronPython 1.1.1. I filed an > issue to nose project's issue tracker for remaining problems. > http://code.google.com/p/python-nose/issues/detail?id=183 are you sure the patch is right ? @@ -146,7 +146,7 @@ self.exclude = None self.getTestCaseNamesCompat = False self.includeExe = env.get('NOSE_INCLUDE_EXE', - sys.platform == 'win32') + sys.platform == ('win32', 'cli')) Isn't it should be "sys.platform in ('win32', 'cli'))" ? From sanxiyn at gmail.com Tue Apr 29 03:56:12 2008 From: sanxiyn at gmail.com (Sanghyeon Seo) Date: Tue, 29 Apr 2008 10:56:12 +0900 Subject: [IronPython] IronPython and nose In-Reply-To: References: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> Message-ID: <5b0248170804281856w32ba479an226e304283eac63d@mail.gmail.com> 2008/4/29 Sakesun Roykiattisak : > are you sure the patch is right ? > > @@ -146,7 +146,7 @@ > self.exclude = None > self.getTestCaseNamesCompat = False > self.includeExe = env.get('NOSE_INCLUDE_EXE', > - sys.platform == 'win32') > + sys.platform == ('win32', 'cli')) > > > > Isn't it should be "sys.platform in ('win32', 'cli'))" ? Oops, you are absolutely right. (Die in shame.) For my defence, this is a documentation, not a code. (It is a documentation including the copy of code to explain how exactly config is set...) I did run full tests before submitting the patch, so executable part is correct... /me dies in shame anyway. -- Seo Sanghyeon From dan.eloff at gmail.com Wed Apr 30 02:04:15 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 29 Apr 2008 19:04:15 -0500 Subject: [IronPython] Threading support in Silverlight Message-ID: <4817b6fc0804291704h1f76cc1bu7457559d7d527b21@mail.gmail.com> Hi, I notice that threading.Timer does not work in Silverlight, is this a known issue? (it never triggers, but doesn't raise any errors either) What is the state on other threading.py objects? Lock() seems to work fine, but I haven't put it through fire. Thanks, -Dan From dan.eloff at gmail.com Wed Apr 30 02:22:14 2008 From: dan.eloff at gmail.com (Dan Eloff) Date: Tue, 29 Apr 2008 19:22:14 -0500 Subject: [IronPython] Threading support in Silverlight In-Reply-To: <4817b6fc0804291704h1f76cc1bu7457559d7d527b21@mail.gmail.com> References: <4817b6fc0804291704h1f76cc1bu7457559d7d527b21@mail.gmail.com> Message-ID: <4817b6fc0804291722x3d685f8ue8f53b8b478ea656@mail.gmail.com> Sorry, false alarm. The timer was firing, but the function I was using to test it contained a print statement, stdout was being redirected to a UI control, and I guess the timer callback gets invoked in a seperate thread, so manipulating the UI is illegal. I suspect there is some error happening somewhere, but it just fails silently. Sorry again, my mistake. -Dan On Tue, Apr 29, 2008 at 7:04 PM, Dan Eloff wrote: > Hi, > > I notice that threading.Timer does not work in Silverlight, is this a > known issue? (it never triggers, but doesn't raise any errors either) > > What is the state on other threading.py objects? Lock() seems to work > fine, but I haven't put it through fire. > > Thanks, > -Dan > From Jimmy.Schementi at microsoft.com Wed Apr 30 02:53:31 2008 From: Jimmy.Schementi at microsoft.com (Jimmy Schementi) Date: Tue, 29 Apr 2008 17:53:31 -0700 Subject: [IronPython] Threading support in Silverlight In-Reply-To: <4817b6fc0804291722x3d685f8ue8f53b8b478ea656@mail.gmail.com> References: <4817b6fc0804291704h1f76cc1bu7457559d7d527b21@mail.gmail.com> <4817b6fc0804291722x3d685f8ue8f53b8b478ea656@mail.gmail.com> Message-ID: <5283CA0A4168DF4FBBD71AE9ECA5A32845802D0107@NA-EXMSG-C116.redmond.corp.microsoft.com> You can use System::DispatchTimer to have the timer events to fire on the same thread. Also, if your initParams source parameter looks something like this: Then you should see error messages. ~js > -----Original Message----- > From: users-bounces at lists.ironpython.com [mailto:users- > bounces at lists.ironpython.com] On Behalf Of Dan Eloff > Sent: Tuesday, April 29, 2008 5:22 PM > To: Discussion of IronPython > Subject: Re: [IronPython] Threading support in Silverlight > > Sorry, false alarm. > > The timer was firing, but the function I was using to test it > contained a print statement, stdout was being redirected to a UI > control, and I guess the timer callback gets invoked in a seperate > thread, so manipulating the UI is illegal. I suspect there is some > error happening somewhere, but it just fails silently. > > Sorry again, my mistake. > > -Dan > > On Tue, Apr 29, 2008 at 7:04 PM, Dan Eloff wrote: > > Hi, > > > > I notice that threading.Timer does not work in Silverlight, is this > a > > known issue? (it never triggers, but doesn't raise any errors > either) > > > > What is the state on other threading.py objects? Lock() seems to > work > > fine, but I haven't put it through fire. > > > > Thanks, > > -Dan > > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com From kamil at dworakowski.name Wed Apr 30 15:09:22 2008 From: kamil at dworakowski.name (Kamil Dworakowski) Date: Wed, 30 Apr 2008 14:09:22 +0100 Subject: [IronPython] IronPython and nose In-Reply-To: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> References: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> Message-ID: <93fc29d60804300609j5cf720eaoff5d51836d95095d@mail.gmail.com> > > Current SVN trunk *almost* works with IronPython 1.1.1. I filed an > issue to nose project's issue tracker for remaining problems. > http://code.google.com/p/python-nose/issues/detail?id=183 What about the dependency on parser.py, which is not available in IronPython? This dep seems trivial to remove, as they only need a constant from compiler module, which imports parser. from compiler.consts import CO_GENERATOR it can be substituted with: CO_GENERATOR=0x0020 -- Kamil -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfugate at microsoft.com Wed Apr 30 18:08:22 2008 From: dfugate at microsoft.com (Dave Fugate) Date: Wed, 30 Apr 2008 09:08:22 -0700 Subject: [IronPython] IronPython and nose In-Reply-To: <93fc29d60804300609j5cf720eaoff5d51836d95095d@mail.gmail.com> References: <5b0248170804281837p26c9342ha8973a57a7cb4387@mail.gmail.com> <93fc29d60804300609j5cf720eaoff5d51836d95095d@mail.gmail.com> Message-ID: Just out of curiosity, has anyone tried using IronPython with py.test? From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Kamil Dworakowski Sent: Wednesday, April 30, 2008 6:09 AM To: Discussion of IronPython Subject: Re: [IronPython] IronPython and nose Current SVN trunk *almost* works with IronPython 1.1.1. I filed an issue to nose project's issue tracker for remaining problems. http://code.google.com/p/python-nose/issues/detail?id=183 What about the dependency on parser.py, which is not available in IronPython? This dep seems trivial to remove, as they only need a constant from compiler module, which imports parser. from compiler.consts import CO_GENERATOR it can be substituted with: CO_GENERATOR=0x0020 -- Kamil -------------- next part -------------- An HTML attachment was scrubbed... URL: From bill at monkey.org Wed Apr 30 18:29:31 2008 From: bill at monkey.org (Bill Merrill) Date: Wed, 30 Apr 2008 12:29:31 -0400 Subject: [IronPython] dbapi parameterization issue (fepy-r7/sqlserver2005) Message-ID: Greetings all, I am using IPCE ipy (not ipy2) to warehouse and analyze large piles of data. I chose it for the dbapi implementation, and it has mostly worked as expected. I chatted with sanxiyn on #ironpython about one problem I was having, he offered a work around, and also asked that I publish what I'm doing to the list. I am using fepy-r7's dbapi to connect via odbc to a sql server 2005 instance. It mostly works as advertised, but I had one issue with using sql parameterization with python long ints. The module does not know how to map a long to the BIGINT column type, and fails with an exception. Here is a table definition and a test program: ''' CREATE TABLE bignumber ( bignumber BIGINT ); ''' import dbapi import odbc as db dbapi._load_type(db.assembly,db.typename) connectstr = 'DSN=dsn;database=db_name;' sql = '''insert into bignumber (bignumber) values (?)''' vals = [10123456789] #10 billion and change dbcon = db.connect(connectstr) cursor = dbcon.cursor() cursor.execute(sql, vals) dbcon.commit() dbcon.close() and here is the traceback: Traceback (most recent call last): File z:\scratch\dbapi_test.py, line 16, in Initialize File c:\IPCE\Lib\dbapi.py, line 108, in execute File , line 0, in ExecuteNonQuery##78 File System.Data, line unknown, in ExecuteNonQuery File System.Data, line unknown, in ExecuteReaderObject File System.Data, line unknown, in ExecuteReaderObject File System.Data, line unknown, in CalcParameterBufferSize File System.Data, line unknown, in PrepareForBind File System.Data, line unknown, in ProcessAndGetParameterValue File System.Data, line unknown, in FromSystemType ValueError: No mapping exists from object type IronMath.BigInteger to a known managed provider native type. The work around suggested by sanxiyn, which works, is to import Int64 and cast the long: from System import Int64 import dbapi import odbc as db dbapi._load_type(db.assembly,db.typename) connectstr = 'DSN=dsn;database=db_name;' sql = '''insert into bignumber (bignumber) values (?)''' vals = [Int64(10123456789)] #10 billion and change dbcon = db.connect(connectstr) cursor = dbcon.cursor() cursor.execute(sql, vals) dbcon.commit() dbcon.close() Thanks to sanxiyn for his help. -Bill