IronPython integration via dotNET

View: New views
4 Messages — Rating Filter:   Alert me  

IronPython integration via dotNET

by loocas duber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there everyone,

it's me again with the IP integration problem :)

I'm on an edge of giving up. I don't know what to do next,
even after reading Lee Holmes' article as suggested by
Michael Foord.

Well, I tried to execute the scriptSourceFromString without
specifying a scope as I've learned that the scope should
be automatically taken care of during the hosting class
instantiation.

These are the last two lines of code I tried to execute:

src = pythonEngine.CreateScriptSourceFromString("print 'hello'")
src.execute()

However, when executed, I get this new, interesting error:

-- Runtime error: dotNet runtime exception: Ambiguous match found.

I did an extensive search on this topic and I found that it might
be related to either a bug in dotNET (hopefully not!) or that
there are two variables in the classes of the same name, but I can't
or don't know how to overcome this.

Anyone has an idea? This is really getting to the point of giving up.
Which'd be bad as I desperately need to call Python from within
MAXScript for our other tools at the studio to communicate with.

Thanks again for your time and effort, guys, much appretiated!

- Lukas
_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: IronPython integration via dotNET

by Michael Foord-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lukas Dubeda wrote:

> Hi there everyone,
>
> it's me again with the IP integration problem :)
>
> I'm on an edge of giving up. I don't know what to do next,
> even after reading Lee Holmes' article as suggested by
> Michael Foord.
>
> Well, I tried to execute the scriptSourceFromString without
> specifying a scope as I've learned that the scope should
> be automatically taken care of during the hosting class
> instantiation.
>
> These are the last two lines of code I tried to execute:
>
> src = pythonEngine.CreateScriptSourceFromString("print 'hello'")
> src.execute()
>
> However, when executed, I get this new, interesting error:
>
> -- Runtime error: dotNet runtime exception: Ambiguous match found.

I would create a simple wrapper class in C# that does all the talking to
IronPython and just exposes a single method that takes a string and
executes it for you. That would get round all the problems you seem to
be having with Max.

I know you don't know C#, but if you start with some of the embedding
examples in IronPython in Action it shouldn't be too hard.

All the best,

Michael Foord

>
> I did an extensive search on this topic and I found that it might
> be related to either a bug in dotNET (hopefully not!) or that
> there are two variables in the classes of the same name, but I can't
> or don't know how to overcome this.
>
> Anyone has an idea? This is really getting to the point of giving up.
> Which'd be bad as I desperately need to call Python from within
> MAXScript for our other tools at the studio to communicate with.
>
> Thanks again for your time and effort, guys, much appretiated!
>
> - Lukas
> _______________________________________________
> Users mailing list
> Users@...
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: IronPython integration via dotNET

by Curt Hagenlocher :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Execute has two variants with zero arity: a generic version and a non-generic version. It sounds like MAXScript isn't able to pick one of these. This isn't surprising for a dynamic language; I think IronPython might have the same problem.

If the MAXScript language doesn't provide a way to manually specify which overload to select, your best bet is probably to write a small C# wrapper library that's a little more MAXScript friendly.

On Fri, Oct 23, 2009 at 5:14 AM, Lukas Dubeda <loocas@...> wrote:
Hi there everyone,

it's me again with the IP integration problem :)

I'm on an edge of giving up. I don't know what to do next,
even after reading Lee Holmes' article as suggested by
Michael Foord.

Well, I tried to execute the scriptSourceFromString without
specifying a scope as I've learned that the scope should
be automatically taken care of during the hosting class
instantiation.

These are the last two lines of code I tried to execute:

src = pythonEngine.CreateScriptSourceFromString("print 'hello'")
src.execute()

However, when executed, I get this new, interesting error:

-- Runtime error: dotNet runtime exception: Ambiguous match found.

I did an extensive search on this topic and I found that it might
be related to either a bug in dotNET (hopefully not!) or that
there are two variables in the classes of the same name, but I can't
or don't know how to overcome this.

Anyone has an idea? This is really getting to the point of giving up.
Which'd be bad as I desperately need to call Python from within
MAXScript for our other tools at the studio to communicate with.

Thanks again for your time and effort, guys, much appretiated!

- Lukas
_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: IronPython integration via dotNET

by loocas duber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks again for the input. I appretiate it.

Well, it seems that this will be a good excuse to
take a look at C# then :) I've tried to avoid it
as much as possible, but it seems I won't be
able to get away without it.

But I'll finish the book first :D

Thanks agian, to Curt Hagenlocher as well!, cheers,

- Lukas

Michael Foord wrote:

> Lukas Dubeda wrote:
>> Hi there everyone,
>>
>> it's me again with the IP integration problem :)
>>
>> I'm on an edge of giving up. I don't know what to do next,
>> even after reading Lee Holmes' article as suggested by
>> Michael Foord.
>>
>> Well, I tried to execute the scriptSourceFromString without
>> specifying a scope as I've learned that the scope should
>> be automatically taken care of during the hosting class
>> instantiation.
>>
>> These are the last two lines of code I tried to execute:
>>
>> src = pythonEngine.CreateScriptSourceFromString("print 'hello'")
>> src.execute()
>>
>> However, when executed, I get this new, interesting error:
>>
>> -- Runtime error: dotNet runtime exception: Ambiguous match found.
>
> I would create a simple wrapper class in C# that does all the talking to
> IronPython and just exposes a single method that takes a string and
> executes it for you. That would get round all the problems you seem to
> be having with Max.
>
> I know you don't know C#, but if you start with some of the embedding
> examples in IronPython in Action it shouldn't be too hard.
>
> All the best,
>
> Michael Foord
>
>>
>> I did an extensive search on this topic and I found that it might
>> be related to either a bug in dotNET (hopefully not!) or that
>> there are two variables in the classes of the same name, but I can't
>> or don't know how to overcome this.
>>
>> Anyone has an idea? This is really getting to the point of giving up.
>> Which'd be bad as I desperately need to call Python from within
>> MAXScript for our other tools at the studio to communicate with.
>>
>> Thanks again for your time and effort, guys, much appretiated!
>>
>> - Lukas
>> _______________________________________________
>> Users mailing list
>> Users@...
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com