[IronPython] WPF module in IronPython scripting?
m.schaber at 3s-software.com
Mon Apr 18 08:24:25 CEST 2011
It may be a problem related to the .NET assembly search path, or it may be the host application blocking/filtering the loading of arbitrary assemblies.
Did you try clr.AddReference() with the Assemblies being in the GAC?
Did you try clr.AddReferencetoFileAndPath()?
Could you try to catch the exception, and explore it for more details (e. G. an inner exception)?
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] Im Auftrag von Lukáš Dubeda
> Gesendet: Freitag, 15. April 2011 19:41
> An: Discussion of IronPython
> Betreff: Re: [IronPython] WPF module in IronPython scripting?
> Unfortunately loading the Assembly didn't work, it threw an error:
> dotNet runtime exception: Could not add reference to assembly
> Nothing else. :(
> Unfortunately we don't have access to the Host app's source at all, we're
> only writing a .NET plugin that enables us to run IronPython inside the
> host app's native scripting language.
> But I'll talk to the programmer who wrote the actual IPy plugin for me and
> see what the problem might be.
> I just thought it's something related to .NET and IPy only.
> Thank you!
> Lukáš Duběda
> [T] +420 602 444 164
> duber studio(tm)
> [M] info at duber.cz
> [W] http://www.duber.cz
> [A] R.A.Dvorského 601, Praha 10
> [A] 10900, Czech Republic, Europe
> On 15.4.2011 18:38, Dino Viehland wrote:
> > Lukáš wrote:
> >> Hi there everyone,
> >> I just bumped into a problem where when I run the IPy.exe console and
> >> execute a script that contains:
> >> import wpf
> >> all works well. However, when I want to import the wpf namespace into
> >> the same script, but run outside the IPy.exe (i.e. as an embedded
> >> engine) I get an error saying that the module wpf doesn't exist!
> >> I even tried to add the IronPython.Wpf.dll into the PATH, I tried
> >> referencing it in my script via clr.AddReferenceToFile, nothing works
> >> and I don't have access to the wpf methods etc...
> >> Is there anything I can do about it?
> > I would have expected AddReferenceToFile to work but what about doing
> > a scriptRuntime.LoadAssembly(typeof(Wpf).Assembly); where the host
> > app has a reference to IronPython.Wpf.dll?
> > I think the code for loading from the DLLs directory is ipy.exe
> > specific - you could also look at replicating that for your host app
> > so there's a general way to add additional Python built-in modules.
> > _______________________________________________
> > 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
More information about the Ironpython-users