Re: [IronPython] 2.0 deployment
Thanks for this Michael. Regards, Kyle -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord Sent: Tuesday, 10 March 2009 9:33 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0 deployment Howland-Rose, Kyle wrote: > Thanks Dody. The error was because I did not deploy Lib and the types module is in Lib. > The types module is part of the Python standard library - you only need to deploy it if you use it. You can compile your Python file and libraries into an executable / assemblies using the Pyc compiler sample - which is available for download on the the IronPython codeplex site. There are some caveats about its use; you will need to add references to any assemblies you import from and some users have reported losing sys.argv when they compile their main executable. In this case it is better to *not* compile your main script, or to create a custom executable in C# which creates the Python engine and executes your main script but doing things like setting up sys.argv and setting the engine search paths. All the best, Michael Foord > I can see that I can successfully deploy by copying the whole of IronPython. > It would be neater to turn the script(s) into an exe and deploy that. > I have only found IPy 1.0 doco on this and the 1.0 doco did not work on 2.0. > > Does anyone know of good IPy 2.0 doco on how to turn IPy scripts into an exe? > > Thanks Dody, thanks all. > > Kyle > > -Original Message- > From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Dody Gunawinata > Sent: Tuesday, 10 March 2009 5:29 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 2.0 deployment > > 1. You will need to deploy all the lib > > * ipy.exe > * IronPython.dll > * IronPython.Modules.dll > * Microsoft.Scripting.Core.dll > * Microsoft.Scripting.dll > * Microsoft.Scripting.ExtensionAttribute.dll > > The last three dlls are DLR which IP 2.0 relies on. > > I never use ipy to deploy application so I'm not sure about the error > you get. It looks like a search path problem. Run ipy.exe in > interactive mode and - I think - type in dir(type) to check whether > ipy has access to the types you need. > > Dody G. > > On Tue, Mar 10, 2009 at 7:57 AM, Howland-Rose, Kyle > wrote: > >> Hi Dody, >> >> Fair question :) >> >> Just a script run from the Windows scheduler that reads a database and writes some files. >> >> Kyle >> -Original Message- >> From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Dody Gunawinata >> Sent: Tuesday, 10 March 2009 4:38 PM >> To: Discussion of IronPython >> Subject: Re: [IronPython] 2.0 deployment >> >> What kind of application are you trying to deploy? ASP.Net with IP >> support? Application with hosted IP? IP scripts? >> >> Dody G. >> >> On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle >> wrote: >> >>> Hi all, >>> >>> My understanding of http://www.ironpython.info/index.php/Deployment is that >>> when deploying to Windows the following need to be deployed: >>> * .NET 2.0 or 3.0 installed >>> * ipy.exe >>> * IronPython.dll >>> * IronMath.dll >>> >>> I thought the IPy 2.0 equiv might be to copy: >>> * ipy.exe >>> * IronPython.dll >>> * IronPython.Modules.dll >>> * Microsoft.Scripting.Core.dll >>> * Microsoft.Scripting.dll >>> * Microsoft.Scripting.ExtensionAttribute.dll >>> >>> but if I then run test.py which imports types I get >>> C:\test>ipy.exe test.py >>> Traceback (most recent call last): >>> File "test.py", line 1, in test.py >>> ImportError: No module named types >>> C:\test> >>> >>> Questions: >>> >>> 1. Do I need to deploy all of Lib? >>> >>> 2. Where should I have been reading about this (sorry). >>> >>> Thanks all. >>> >>> Regards, >>> Kyle >>> >>> >>> >>> >>> >>> Allens Arthur Robinson online: http://www.aar.com.au >>> >>> This email is confidential and may be subject to legal or other professional >>> privilege. It is also subject to copyright. If you have received it in >>> error, confidentiality and privilege are not waived and you must not >>> disclose or use the information in it. Please notify the sender by return >>> email and delete it from your system. Any personal information in this email >>> must be handled in accordance with the Privacy Act 1988 (Cth). >>> >>> * >>> >>> ___ >>> Users mailing list >>> Users@lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >>> >> >> -- >> nomadlife.org >> ___ >> Users mailing list >> Users@lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> **
Re: [IronPython] import thread-safety
This is fixed in 2.6 and we can backport the fix to 2.0. Could you open a bug on CodePlex? If you want to add the fix locally you just need to add the lock statement below to NewTypeMaker.StoreOverriddenMethods: lock(PythonTypeOps._functions) { foreach (BuiltinFunction bf in PythonTypeOps._functions.Values) { if (bf.Name == pythonName && bf.DeclaringType == declType) { bf.AddMethod(mi); break; } } } > -Original Message- > From: users-boun...@lists.ironpython.com [mailto:users- > boun...@lists.ironpython.com] On Behalf Of Kamil Dworakowski > Sent: Tuesday, March 10, 2009 11:08 AM > To: users@lists.ironpython.com > Subject: [IronPython] import thread-safety > > Hello, > > I tried reactivate parallel importing in Resolver One. More info in > this thread from October: > http://groups.google.com/group/ironpy/browse_thread/thread/11c5c917d716 > b7cc/58ce4e4260c2773a?lnk=gst&q=parallel+import#58ce4e4260c2773a > > I hit a problem. Sometimes during importing I get the following > exception. It is a bit of a haisenbug because whenever I try to add > some diagnostics Resolver One starts fine. > > CLS Exception: System.InvalidOperationException: Collection was > modified; enumeration operation may not execute. >at System.ThrowHelper.ThrowInvalidOperationException > (ExceptionResource resource) >at > System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.Move > Next > () >at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod > (MethodInfo mi, String newName) >at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type > finishedType, Dictionary`2 specialNames) >at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() >at > IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b_ > _0 > () >at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, > Func`1 create) >at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String > typeName, PythonTuple bases, IAttributesCollection dict) >at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, > String name, PythonTuple bases, IAttributesCollection dict) >at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, > PythonType cls, String name, PythonTuple bases, IAttributesCollection > dict) >at _stub_$270##128(Closure , CallSite , CodeContext , Object , > String , PythonTuple , IAttributesCollection ) >at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > context, String name, Object[] bases, String selfNames, > IAttributesCollection vars) >at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext > context, String name, Object[] bases, String selfNames, CallTarget0 > body) >at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope, > LanguageContext $language) >at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression > code, Scope scope) >at Microsoft.Scripting.ScriptCode.Run(Scope scope) >at IronPython.Runtime.PythonContext.CreateModule(String fileName, > Scope scope, ScriptCode scriptCode, ModuleOptions options) >at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, > String fullName) >at _stub_$367##225(Closure , CallSite , CodeContext , Object , > Object[] ) >at IronPython.Runtime.PythonContext.Call(Object func, Object[] > args) >at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter > (CodeContext context, Object importer, String fullName, List path, > Object& ret) >at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext > context, String fullName, List path, Object& ret) >at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule > (CodeContext context, String fullName, List path, Object& ret) >at IronPython.Runtime.Importer.ImportNestedModule(CodeContext > context, Scope scope, String name, List path) >at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext > context, Object from, String name) >at IronPython.Runtime.Importer.ImportModule(CodeContext context, > Object globals, String modName, Boolean bottom, Int32 level) >at IronPython.Runtime.Builtin.__import__(CodeContext context, > String name, Object globals, Object locals, Object fromlist, Int32 > level) >at IronPython.Runtime.Builtin.__import__(CodeContext context, > String name) >at _stub_$548##406(Closure , CallSite , CodeContext , Object , > Object ) >at DLRCachedCode.worker$736(Closure ) > CLS Stack trace: > >at System.ThrowHelper.ThrowInvalidOperationException > (ExceptionResource resource) >at > System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.Move > Next > () >at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod > (MethodInfo mi, String newName) >at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type > finishedType, Dictionary`2 specialNames) >at IronPython.Runtime.Types.NewTypeMaker.C
[IronPython] import thread-safety
Hello, I tried reactivate parallel importing in Resolver One. More info in this thread from October: http://groups.google.com/group/ironpy/browse_thread/thread/11c5c917d716b7cc/58ce4e4260c2773a?lnk=gst&q=parallel+import#58ce4e4260c2773a I hit a problem. Sometimes during importing I get the following exception. It is a bit of a haisenbug because whenever I try to add some diagnostics Resolver One starts fine. CLS Exception: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext () at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod (MethodInfo mi, String newName) at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type finishedType, Dictionary`2 specialNames) at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() at IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b__0 () at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, Func`1 create) at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String typeName, PythonTuple bases, IAttributesCollection dict) at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, String name, PythonTuple bases, IAttributesCollection dict) at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, PythonType cls, String name, PythonTuple bases, IAttributesCollection dict) at _stub_$270##128(Closure , CallSite , CodeContext , Object , String , PythonTuple , IAttributesCollection ) at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext context, String name, Object[] bases, String selfNames, IAttributesCollection vars) at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext context, String name, Object[] bases, String selfNames, CallTarget0 body) at DLRCachedCode.Main\RenameWorksheetTextBoxAdaptor(Scope $scope, LanguageContext $language) at Microsoft.Scripting.ScriptCode.InvokeTarget(LambdaExpression code, Scope scope) at Microsoft.Scripting.ScriptCode.Run(Scope scope) at IronPython.Runtime.PythonContext.CreateModule(String fileName, Scope scope, ScriptCode scriptCode, ModuleOptions options) at IronPython.Runtime.ModuleLoader.load_module(CodeContext context, String fullName) at _stub_$367##225(Closure , CallSite , CodeContext , Object , Object[] ) at IronPython.Runtime.PythonContext.Call(Object func, Object[] args) at IronPython.Runtime.Importer.FindAndLoadModuleFromImporter (CodeContext context, Object importer, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.TryLoadMetaPathModule(CodeContext context, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.TryGetExistingOrMetaPathModule (CodeContext context, String fullName, List path, Object& ret) at IronPython.Runtime.Importer.ImportNestedModule(CodeContext context, Scope scope, String name, List path) at IronPython.Runtime.Importer.ImportModuleFrom(CodeContext context, Object from, String name) at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level) at IronPython.Runtime.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level) at IronPython.Runtime.Builtin.__import__(CodeContext context, String name) at _stub_$548##406(Closure , CallSite , CodeContext , Object , Object ) at DLRCachedCode.worker$736(Closure ) CLS Stack trace: at System.ThrowHelper.ThrowInvalidOperationException (ExceptionResource resource) at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext () at IronPython.Runtime.Types.NewTypeMaker.StoreOverriddenMethod (MethodInfo mi, String newName) at IronPython.Runtime.Types.NewTypeMaker.AddBaseMethods(Type finishedType, Dictionary`2 specialNames) at IronPython.Runtime.Types.NewTypeMaker.CreateNewType() at IronPython.Runtime.Types.NewTypeMaker.<>c__DisplayClass1.b__0 () at Microsoft.Scripting.Utils.Publisher`2.GetOrCreateValue(TKey key, Func`1 create) at IronPython.Runtime.Types.NewTypeMaker.GetNewType(String typeName, PythonTuple bases, IAttributesCollection dict) at IronPython.Runtime.Types.PythonType..ctor(CodeContext context, String name, PythonTuple bases, IAttributesCollection dict) at IronPython.Runtime.Types.PythonType.__new__(CodeContext context, PythonType cls, String name, PythonTuple bases, IAttributesCollection dict) at _stub_$270##128(Closure , CallSite , CodeContext , Object , String , PythonTuple , IAttributesCollection ) at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext context, String name, Object[] bases, String selfNames, IAttributesCollection vars) at IronPython.Runtime.Operations.PythonOps.MakeClass(CodeContext context, String name, Object[] bases, String selfNames, CallTarget0 body) at D
Re: [IronPython] 2.0 deployment
Howland-Rose, Kyle wrote: Thanks Dody. The error was because I did not deploy Lib and the types module is in Lib. The types module is part of the Python standard library - you only need to deploy it if you use it. You can compile your Python file and libraries into an executable / assemblies using the Pyc compiler sample - which is available for download on the the IronPython codeplex site. There are some caveats about its use; you will need to add references to any assemblies you import from and some users have reported losing sys.argv when they compile their main executable. In this case it is better to *not* compile your main script, or to create a custom executable in C# which creates the Python engine and executes your main script but doing things like setting up sys.argv and setting the engine search paths. All the best, Michael Foord I can see that I can successfully deploy by copying the whole of IronPython. It would be neater to turn the script(s) into an exe and deploy that. I have only found IPy 1.0 doco on this and the 1.0 doco did not work on 2.0. Does anyone know of good IPy 2.0 doco on how to turn IPy scripts into an exe? Thanks Dody, thanks all. Kyle -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Tuesday, 10 March 2009 5:29 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0 deployment 1. You will need to deploy all the lib * ipy.exe * IronPython.dll * IronPython.Modules.dll * Microsoft.Scripting.Core.dll * Microsoft.Scripting.dll * Microsoft.Scripting.ExtensionAttribute.dll The last three dlls are DLR which IP 2.0 relies on. I never use ipy to deploy application so I'm not sure about the error you get. It looks like a search path problem. Run ipy.exe in interactive mode and - I think - type in dir(type) to check whether ipy has access to the types you need. Dody G. On Tue, Mar 10, 2009 at 7:57 AM, Howland-Rose, Kyle wrote: Hi Dody, Fair question :) Just a script run from the Windows scheduler that reads a database and writes some files. Kyle -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Tuesday, 10 March 2009 4:38 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0 deployment What kind of application are you trying to deploy? ASP.Net with IP support? Application with hosted IP? IP scripts? Dody G. On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle wrote: Hi all, My understanding of http://www.ironpython.info/index.php/Deployment is that when deploying to Windows the following need to be deployed: * .NET 2.0 or 3.0 installed * ipy.exe * IronPython.dll * IronMath.dll I thought the IPy 2.0 equiv might be to copy: * ipy.exe * IronPython.dll * IronPython.Modules.dll * Microsoft.Scripting.Core.dll * Microsoft.Scripting.dll * Microsoft.Scripting.ExtensionAttribute.dll but if I then run test.py which imports types I get C:\test>ipy.exe test.py Traceback (most recent call last): File "test.py", line 1, in test.py ImportError: No module named types C:\test> Questions: 1. Do I need to deploy all of Lib? 2. Where should I have been reading about this (sorry). Thanks all. Regards, Kyle Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). * ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com -- nomadlife.org ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in error, confidentiality and privilege are not waived and you must not disclose or use the information in it. Please notify the sender by return email and delete it from your system. Any personal information in this email must be handled in accordance with the Privacy Act 1988 (Cth). * _
Re: [IronPython] 2.0 deployment
Thanks Dody. The error was because I did not deploy Lib and the types module is in Lib. I can see that I can successfully deploy by copying the whole of IronPython. It would be neater to turn the script(s) into an exe and deploy that. I have only found IPy 1.0 doco on this and the 1.0 doco did not work on 2.0. Does anyone know of good IPy 2.0 doco on how to turn IPy scripts into an exe? Thanks Dody, thanks all. Kyle -Original Message- From: users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of Dody Gunawinata Sent: Tuesday, 10 March 2009 5:29 PM To: Discussion of IronPython Subject: Re: [IronPython] 2.0 deployment 1. You will need to deploy all the lib * ipy.exe * IronPython.dll * IronPython.Modules.dll * Microsoft.Scripting.Core.dll * Microsoft.Scripting.dll * Microsoft.Scripting.ExtensionAttribute.dll The last three dlls are DLR which IP 2.0 relies on. I never use ipy to deploy application so I'm not sure about the error you get. It looks like a search path problem. Run ipy.exe in interactive mode and - I think - type in dir(type) to check whether ipy has access to the types you need. Dody G. On Tue, Mar 10, 2009 at 7:57 AM, Howland-Rose, Kyle wrote: > > Hi Dody, > > Fair question :) > > Just a script run from the Windows scheduler that reads a database and writes > some files. > > Kyle > -Original Message- > From: users-boun...@lists.ironpython.com > [mailto:users-boun...@lists.ironpython.com] On Behalf Of Dody Gunawinata > Sent: Tuesday, 10 March 2009 4:38 PM > To: Discussion of IronPython > Subject: Re: [IronPython] 2.0 deployment > > What kind of application are you trying to deploy? ASP.Net with IP > support? Application with hosted IP? IP scripts? > > Dody G. > > On Tue, Mar 10, 2009 at 5:27 AM, Howland-Rose, Kyle > wrote: >> Hi all, >> >> My understanding of http://www.ironpython.info/index.php/Deployment is that >> when deploying to Windows the following need to be deployed: >> * .NET 2.0 or 3.0 installed >> * ipy.exe >> * IronPython.dll >> * IronMath.dll >> >> I thought the IPy 2.0 equiv might be to copy: >> * ipy.exe >> * IronPython.dll >> * IronPython.Modules.dll >> * Microsoft.Scripting.Core.dll >> * Microsoft.Scripting.dll >> * Microsoft.Scripting.ExtensionAttribute.dll >> >> but if I then run test.py which imports types I get >> C:\test>ipy.exe test.py >> Traceback (most recent call last): >> File "test.py", line 1, in test.py >> ImportError: No module named types >> C:\test> >> >> Questions: >> >> 1. Do I need to deploy all of Lib? >> >> 2. Where should I have been reading about this (sorry). >> >> Thanks all. >> >> Regards, >> Kyle >> >> >> >> >> >> Allens Arthur Robinson online: http://www.aar.com.au >> >> This email is confidential and may be subject to legal or other professional >> privilege. It is also subject to copyright. If you have received it in >> error, confidentiality and privilege are not waived and you must not >> disclose or use the information in it. Please notify the sender by return >> email and delete it from your system. Any personal information in this email >> must be handled in accordance with the Privacy Act 1988 (Cth). >> >> * >> >> ___ >> Users mailing list >> Users@lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> >> > > > > -- > nomadlife.org > ___ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > Allens Arthur Robinson online: http://www.aar.com.au > > This email is confidential and may be subject to legal or other professional > privilege. It is also subject to copyright. If you have received it in error, > confidentiality and privilege are not waived and you must not disclose or use > the information in it. Please notify the sender by return email and delete it > from your system. Any personal information in this email must be handled in > accordance with the Privacy Act 1988 (Cth). > > * > ___ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > -- nomadlife.org ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com Allens Arthur Robinson online: http://www.aar.com.au This email is confidential and may be subject to legal or other professional privilege. It is also subject to copyright. If you have received it in