[IronPython] Hosting IP2 Beta2 in Mono?

Dino Viehland dinov at exchange.microsoft.com
Thu May 22 05:16:09 CEST 2008


BTW I think the lack of requiring assignment is the same issue as http://lists.ironpython.com/pipermail/users-ironpython.com/2007-October/005842.html.  I'll fix the code.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Zoltan Varga
Sent: Monday, May 19, 2008 1:12 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Hosting IP2 Beta2 in Mono?

Hi,

The relevant code is the following:

                DynamicSite<object, object, object> mapSite;
                if (func != null) mapSite =
CallSiteFactory.CreateSimpleCallSite<object, object,
object>(DefaultContext.DefaultPythonBinder);


                IEnumerator i = PythonOps.GetEnumerator(param[1]);
                while (i.MoveNext()) {
                    if (func == null) ret.AddNoLock(i.Current);
                    else
ret.AddNoLock(mapSite.Invoke(DefaultContext.Default, func,
i.Current));

Here, mapSite is not initialized. I'm not sure why the MS.NET C#
compiler allows this.

There is another similar case in the same method:

                DynamicSite<object, object[], object> mapSite;
                while (true) {
                    bool done = true;
                    for (int i = 0; i < enums.Length; i++) {
                        if (enums[i].MoveNext()) {
                            args[i] = enums[i].Current;
                            done = false;
                        } else {
                            args[i] = null;
                        }
                    }
                    if (done) {
                        return ret;
                    }
                    if (func != null) {
                        // splat call w/ args, can't use site here yet...
                        if (!mapSite.IsInitialized) {

As for the resource problem, try this in the nant build file:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                <resgen input="Microsoft.Scripting.Core/Microsoft.Scripting.txt"
output="Microsoft.Scripting.Core/Microsoft.Scripting.Core.resources"/>
                <csc target="library" define="${defines}"
output="Microsoft.Scripting.Core.dll">
                        <sources>
                                <include name="Microsoft.Scripting.Core/**/*.cs"/>
                        </sources>
                        <resources dynamicprefix="true" basedir="Microsoft.Scripting.Core">
                                <include name="Microsoft.Scripting.Core.resources"/>
                        </resources>
                        <references>
                                <include name="System.Configuration.dll"/>
                        </references>
                </csc>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

                                Zoltan

On Mon, May 19, 2008 at 8:52 PM, Douglas S. Blank <dblank at brynmawr.edu> wrote:
> I'm attempting to bring the IronPython Community Edition up to date with
> IP2B2, and having a couple of issues. I've documented everything needed to
> build it here:
>
> http://wiki.roboteducation.org/IronPython2B2
>
> The first is a problem with mapSite in Src/IronPython/Runtime/Builtin.cs.
> The Mono csharp compiler is complaining that mapSite is uninitialized. Any
> ideas?
>
> The second is comping up with a valid nant xml with the right pieces
> defined. I can get it to build, and run, but it crashes with:
>
> $ mono Src/ipy.exe
> IronPython 2.0 Beta (0.0.0.0) on .NET 2.0.50727.42
> Copyright (c) Microsoft Corporation. All rights reserved.
>>>> 1
> Unhandled exception:
>
> Unhandled Exception: System.Resources.MissingManifestResourceException:
> Could not find any resources appropriate for the specified culture or the
> neutral culture.  Make sure "Microsoft.Scripting.Core.resources" was
> correctly embedded or linked into assembly "Microsoft.Scripting.Core" at
> compile time, or that all the satellite assemblies required are loadable and
> fully signed.
>  at System.Resources.ResourceManager.AssemblyResourceMissing (System.String
> fileName) [0x00000]
>  at System.Resources.ResourceManager.InternalGetResourceSet
> (System.Globalization.CultureInfo culture, Boolean Createifnotexists,
> Boolean tryParents) [0x00000]
> ...
>
> I suspect that the nant xml is incorrect. The relevant part I have added is:
>
>    <csc target="library" output="Microsoft.Scripting.Core.dll"
>        warninglevel="${warn}">
>        <sources>
>            <include name="Microsoft.Scripting.Core/**/*.cs"/>
>        </sources>
>        <references>
>            <include name="System.Configuration.dll"/>
>        </references>
>    </csc>
>
> Any ideas on these two points would be very helpful.
>
> -Doug
>
> Douglas S. Blank wrote:
>>
>> On Fri, May 9, 2008 11:37 pm, Curt Hagenlocher said:
>>>
>>> We added Microsoft.Scripting.Core.dll in Beta2; you'll probably need to
>>> add
>>> a reference to that.
>>
>> Curt, thanks for the quick feedback! You are right, and now I need to
>> figure out how to make that happen.
>>
>> Seo, et al: any chance of updating the IPCE build to work with IP2Beta2?
>> It looks like the Microsoft.Scripting.Core.dll requirement isn't going
>> away, so it won't be wasted effort. (Or someone point me in the right
>> direction, and I'll try to do it).
>>
>> I did try using the MS .dll's directly from CodePlex in Mono, and it
>> almost works. It builds fine, but *looks* like there is a bug that
>> prevents Mono from evaluating some statements (like "import sys"). The
>> stack trace from inside my c# code is below. If you think it is something
>> else, please let me know.
>>
>> I'd also be interested in other options to using IP2B2 (other than
>> retreating to an earlier IP). I fairly new to all of this, so maybe I am
>> missing something obvious.
>>
>> -Doug
>>
>> System.Reflection.TargetInvocationException: Exception has been thrown by
>> the target of an invocation. ---> System.ArgumentException: The method
>> should be static.
>> Parameter name: method
>>  at System.Delegate.CreateDelegate (System.Type type,
>> System.Reflection.MethodInfo method, Boolean throwOnBindFailure)
>> [0x00000]
>>  at System.Delegate.CreateDelegate (System.Type type,
>> System.Reflection.MethodInfo method) [0x00000]
>>  at
>>
>> Microsoft.Scripting.Utils.InvokeHelper`3[Microsoft.Scripting.Actions.CallSite`1[Microsoft.Scripting.Actions.DynamicSiteTarget`6[System.Object,System.String,Microsoft.Scripting.IAttributesCollection,Microsoft.Scripting.IAttributesCollection,IronPython.Runtime.PythonTuple,System.Object]],Microsoft.Scripting.Actions.DynamicSiteTarget`6[System.Object,System.String,Microsoft.Scripting.IAttributesCollection,Microsoft.Scripting.IAttributesCollection,IronPython.Runtime.PythonTuple,System.Object],Microsoft.Scripting.Actions.CallSite`1[Microsoft.Scripting.Actions.DynamicSiteTarget`6[System.Object,System.String,Microsoft.Scripting.IAttributesCollection,Microsoft.Scripting.IAttributesCollection,IronPython.Runtime.PythonTuple,System.Object]]]..ctor
>> (System.Reflection.MethodInfo ) [0x00000]
>>  at <0x00000> <unknown method>
>>  at (wrapper managed-to-native)
>> System.Reflection.MonoCMethod:InternalInvoke (object,object[])
>>  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags
>> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
>> System.Globalization.CultureInfo culture) [0x00000] --- End of inner
>> exception stack trace ---
>>
>>  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags
>> invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
>> System.Globalization.CultureInfo culture) [0x00000]
>>  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr,
>> System.Reflection.Binder binder, System.Object[] parameters,
>> System.Globalization.CultureInfo culture) [0x00000]
>>  at System.Activator.CreateInstance (System.Type type, BindingFlags
>> bindingAttr, System.Reflection.Binder binder, System.Object[] args,
>> System.Globalization.CultureInfo culture, System.Object[]
>> activationAttributes) [0x00000]
>>  at System.Activator.CreateInstance (System.Type type, System.Object[]
>> args, System.Object[] activationAttributes) [0x00000]
>>  at System.Activator.CreateInstance (System.Type type, System.Object[]
>> args) [0x00000]
>>  at Microsoft.Scripting.Utils.ReflectedCaller.SlowCreate
>> (System.Reflection.MethodInfo info, System.Reflection.ParameterInfo[]
>> pis) [0x00000]
>>  at Microsoft.Scripting.Utils.ReflectedCaller.FastCreate
>> (System.Reflection.MethodInfo target, System.Reflection.ParameterInfo[]
>> pi) [0x00000]
>>  at Microsoft.Scripting.Utils.ReflectedCaller.Create
>> (System.Reflection.MethodInfo info) [0x00000]
>>>
>>> On Fri, May 9, 2008 at 8:25 PM, Douglas S. Blank <dblank at brynmawr.edu>
>>> wrote:
>>>
>>>> Does anyone have an example of IronPython2 Beta2 Hosting in C# working
>>>> with Mono 1.9? I think I have all of the pieces in place, but get an
>>>> error
>>>> that ScriptRuntime can not be found on build.
>>>>
>>>> Any pointers appreciated!
>>>>
>>>> -Doug
>>>>
> _______________________________________________
> 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



More information about the Ironpython-users mailing list