This looks like a classic and continually frustrating Fusion problem.
 (Fusion is the .NET loader.)  When you use Assembly.LoadFrom, it doesn't
automatically add the assembly's directory into any kind of search path.  So
the dependencies of IronPython.dll can't automatically be found to be
loaded.
Your best bet for solving this is to put IronPython and all its dependencies
into the GAC.  It might also work to put the IronPython directory into the
path.

On Mon, Dec 29, 2008 at 7:16 PM, Stephen Ng <step...@theleengs.com> wrote:

> Hello IronPython users,
> I have a largish Powershell script I'd like to migrate to IronPython.
>  (Powershell is a fine language, but there are a lot more Python developers
> where I work).
>
>  The Powershell script manipulates VMware ESX machines, using their VI
> Toolkit (http://blogs.vmware.com/vipowershell/).
>
> So, I'm hoping that I can have my Powershell script host IronPython, and
> have a minimum of Powershell to create objects which I then pass over to
> IronPython and have IronPython do most of the work.
>
> Does this approach sound reasonable?  I've done a fair amount of Powershell
> and Python programming, but I'm not that familiar with IronPython (or .Net
> even).  I'm having trouble even getting started.  I saw this blog entry (
> http://stevegilham.blogspot.com/2008/02/embedding-powershell-in-ironpython.html)
> but "$pythonEngine = [ironpython.hosting.pythonengine]::CurrentEngine" seems
> out of date.  I changed it to CreateEngine(), but now I'm getting an error
> loading Microsoft.Scripting.  Doing a loadFrom of Microsoft.Scripting*.dll
> from the IronPython dir doesn't seem to help.
>
> PS C:\Documents and Settings\sng>
> [reflection.assembly]::loadFrom("C:\Program Files\IronPython
> 2.0\IronPython.dll")
> GAC    Version        Location
> ---    -------        --------
> True   v2.0.50727
> C:\WINDOWS\assembly\GAC_MSIL\IronPython\2.0.0.0__31bf3...
>
> PS C:\Documents and Settings\sng>
> [IronPython.Hosting.Python]::CreateEngine()
> Exception retrieving member "CreateEngine": "Could not load file or
> assembly 'Microsoft.Scripting, Version=0.9.0.0,
> Culture=neutral,PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
> The system cannot find the file specified."
> At line:1 char:42
> + [IronPython.Hosting.Python]::CreateEngine( <<<< )
>
> Any help would be greatly appreciated....
>
> Thanks,
>
> Steve
>
> _______________________________________________
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to