The bug at http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=26793 suggests you might have success with clr.LoadAssemblyFromFile. Otherwise, you might be able to use the Fusion log viewer ( http://msdn.microsoft.com/en-us/library/e74a18c4(VS.80).aspx) to debug the assembly load process.
2010/5/27 Bakalar, Matthew (NIH/CIT) [C] <bakala...@mail.nih.gov> > In response to Lukas: > > I copied all of the assemblies, along with the script, to one folder. I > attempted to add a reference to MathNet.Iridium and received the following > error: > > > > >>> clr.AddReferenceByPartialName('MathNet.Iridium') > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > IOError: System.IO.IOException: Could not add reference to assembly > MathNet.Irid > > ium > > at > Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] arg > > s, Boolean& shouldOptimize) > > at > IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(Cal > > lSite site, CodeContext context, TFuncType func, T0 arg0) > > at > System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite s > > ite, T0 arg0, T1 arg1, T2 arg2) > > at > IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(Cal > > lSite site, CodeContext context, TFuncType func, T0 arg0) > > at > IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedF > > rame frame) > > at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame > frame) > > at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, > T1 a > > rg1) > > at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) > > at IronPython.Compiler.PythonScriptCode.Run(Scope scope) > > at > IronPython.Hosting.PythonCommandLine.<>c__DisplayClass1.<RunOneInteraction > > >b__0() > > > > This leads me to believe IronPython is having trouble loading this > particular assembly, but I cannot decode the error message. Have you ever > seen this trace before? > > > > In Response to David: > > I tried the solution you suggested with no luck. The error message I > receive is the same. I suspect that the hint I've provided above might lead > us to a solution. > > > > Thanks All, > > > > Matthew Bakalar > > > > *From:* Lukas Cenovsky [mailto:cenov...@bakalari.cz] > *Sent:* Thursday, May 27, 2010 2:48 AM > *To:* Discussion of IronPython > *Subject:* Re: [IronPython] Internal Assembly Dependency > > > > Bakalar, Matthew (NIH/CIT) [C] wrote: > > Hello All, > > I am new to IronPython, relatively new to C#, and new to this list. I have > a C# assembly that I am attempting to access from IronPython. I am able to > load the assembly using: > > clr.AddReferenceToFileAndPath(mypath) > > without any problems. I can then import the classes that reside within my > assembly as well, create instances of these classes, and call certain > methods on these instances. There are methods within this assembly that rely > on a reference to another assembly (MathNet.Iridium). When I attempt to call > these methods from my IronPython script, I receive the following error: > > IOError: [Errno 2] Could not load file or assembly 'MathNet.Iridium, > Version=2008.8.16.470, Culture=neutral, PublicKeyToken=c061a3ec32cc0c6f' or > one of its dependencies. The system cannot find the file specified. > > Now, I never added a reference to MathNet.Iridium in my script. However, I > assumed that the C# assembly that I am calling directly was compiled with a > reference to this other assembly, and that I would not have to explicitly > add a reference. When I create a test assembly entirely in C# that calls the > assembly I am attempting to call, and do not include a reference to the > MathNet.Iridium assembly, I am able to execute the code without problems. Do > I need to add a reference to the MathNet.Iridium assembly from within my > IronPython script even though I don't intend to access it directly? > > Thanks > > Matthew Bakalar > > > First, try to copy all necessary assemblies to the folder with your script > and use AddReference for all of them. If that works, you can experiment with > assemblies in different folders. > > Note, the path in AddReferenceToFileAndPath should be full path. > > -- > -- Lukáš > > _______________________________________________ > 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