Oh! Such a stupid mistake... Thanks Dino!

--
-- Lukáš


Dino Viehland wrote:

Ahh, you need to drop the "\bar.dll" from the path -- it should just be the directory where bar.dll lives.

*From:* users-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky
*Sent:* Thursday, May 20, 2010 12:39 PM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] Add reference to .dll located in above directory

Dino Viehland wrote:

Lukáš wrote:
    Yes, the above works for me too, but the following one does not:

    F:\Product\1\Dlr\x\module > ipy foo.py

Even with the full path added to sys.path instead of the relative path? Because this one works for me as well.

This is strange. It does not work for me even with the full path.
I run it on IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927 on Win7 64-bit

Directory of M:\root

20.05.2010  21:29    <DIR>          .
20.05.2010  21:29    <DIR>          ..
19.03.2010  11:15            34 648 ipy.exe
19.03.2010  11:15         1 496 920 IronPython.dll
19.03.2010  11:15           464 728 IronPython.Modules.dll
19.03.2010  11:15           956 248 Microsoft.Dynamic.dll
19.03.2010  11:15           403 288 Microsoft.Scripting.Core.dll
19.03.2010  11:15            58 200 Microsoft.Scripting.Debugging.dll
19.03.2010  11:15           178 008 Microsoft.Scripting.dll
19.03.2010 11:15 11 096 Microsoft.Scripting.ExtensionAttribute.dll
20.05.2010  21:29    <DIR>          test
               8 File(s)      3 603 136 bytes

 Directory of M:\root\test

20.05.2010  21:29    <DIR>          .
20.05.2010  21:29    <DIR>          ..
20.05.2010  21:20             4 608 bar.dll
20.05.2010  21:29    <DIR>          module
               1 File(s)          4 608 bytes

 Directory of M:\root\test\module

20.05.2010  21:29    <DIR>          .
20.05.2010  21:29    <DIR>          ..
20.05.2010  21:21               128 foo.py
               1 File(s)            128 bytes

foo.py contains:

import clr
import sys
sys.path.append(r'M:\root\test\bar.dll')
clr.AddReference('bar')
import bar
print 'oki'

bar.py contains:

print 'from bar'


M:\root\test>M:\root\ipy.exe module\foo.py
from bar
oki

M:\root\test\module>M:\root\ipy.exe foo.py
Traceback (most recent call last):
  File "foo.py", line 4, in <module>
IOError: System.IO.IOException: Could not add reference to assembly bar
at Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args, Boolean& shouldOptimize) at IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(CallSite site, CodeContext context, TFuncType func, T0 arg0) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at IronPython.Runtime.Types.BuiltinFunction.BuiltinMethodCaller`2.Call1(CallSite site, CodeContext context, TFuncType func, T0 arg0) at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
   at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)
   at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName)
   at IronPython.Hosting.PythonCommandLine.RunFile(String fileName)

--
-- 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

Reply via email to