<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor=white lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Ahh, you need to drop the “\bar.dll” from the path –
it should just be the directory where bar.dll lives.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:
"Tahoma","sans-serif";color:windowtext'> users-bounces@lists.ironpython.com
[mailto:users-bounces@lists.ironpython.com] <b>On Behalf Of </b>Lukas Cenovsky<br>
<b>Sent:</b> Thursday, May 20, 2010 12:39 PM<br>
<b>To:</b> Discussion of IronPython<br>
<b>Subject:</b> Re: [IronPython] Add reference to .dll located in above
directory<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Dino Viehland wrote: <o:p></o:p></p>
<pre>Lukáš wrote:<o:p></o:p></pre><pre> <o:p></o:p></pre>
<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><pre>Yes, the above works for me too, but the following one does not:<o:p></o:p></pre><pre><o:p> </o:p></pre><pre>F:\Product\1\Dlr\x\module > ipy foo.py<o:p></o:p></pre><pre> <o:p></o:p></pre></blockquote>
<pre><o:p> </o:p></pre><pre>Even with the full path added to sys.path instead of the relative <o:p></o:p></pre><pre>path? Because this one works for me as well.<o:p></o:p></pre><pre> <o:p></o:p></pre>
<p class=MsoNormal><br>
This is strange. It does not work for me even with the full path.<br>
I run it on IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.4927 on Win7
64-bit<br>
<br>
Directory of M:\root<br>
<br>
20.05.2010 21:29
<DIR> .<br>
20.05.2010 21:29
<DIR> ..<br>
19.03.2010
11:15
34 648 ipy.exe<br>
19.03.2010 11:15
1 496 920 IronPython.dll<br>
19.03.2010
11:15 464 728
IronPython.Modules.dll<br>
19.03.2010
11:15 956 248
Microsoft.Dynamic.dll<br>
19.03.2010
11:15 403 288
Microsoft.Scripting.Core.dll<br>
19.03.2010
11:15
58 200 Microsoft.Scripting.Debugging.dll<br>
19.03.2010
11:15 178 008
Microsoft.Scripting.dll<br>
19.03.2010
11:15
11 096 Microsoft.Scripting.ExtensionAttribute.dll<br>
20.05.2010 21:29
<DIR> test<br>
8 File(s) 3 603 136 bytes<br>
<br>
Directory of M:\root\test<br>
<br>
20.05.2010 21:29
<DIR> .<br>
20.05.2010 21:29
<DIR> ..<br>
20.05.2010
21:20
4 608 bar.dll<br>
20.05.2010 21:29
<DIR> module<br>
1 File(s) 4 608
bytes<br>
<br>
Directory of M:\root\test\module<br>
<br>
20.05.2010 21:29
<DIR> .<br>
20.05.2010 21:29
<DIR> ..<br>
20.05.2010
21:21
128 foo.py<br>
1 File(s) 128
bytes<br>
<br>
foo.py contains:<br>
<br>
import clr<br>
import sys<br>
sys.path.append(r'M:\root\test\bar.dll')<br>
clr.AddReference('bar')<br>
import bar<br>
print 'oki'<br>
<br>
bar.py contains:<br>
<br>
print 'from bar'<br>
<br>
<br>
M:\root\test>M:\root\ipy.exe module\foo.py<br>
from bar<br>
oki<br>
<br>
M:\root\test\module>M:\root\ipy.exe foo.py<br>
Traceback (most recent call last):<br>
File "foo.py", line 4, in <module><br>
IOError: System.IO.IOException: Could not add reference to assembly bar<br>
at
Microsoft.Scripting.Actions.Calls.MethodCandidate.Caller.Call(Object[] args,
Boolean& shouldOptimize)<br>
at
IronPython.Runtime.Types.BuiltinFunction.BuiltinFunctionCaller`2.Call1(CallSite
site, CodeContext context, TFuncType func, T0 arg0)<br>
at
System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site,
T0 arg0, T1 arg1, T2 arg2)<br>
at
IronPython.Runtime.Types.BuiltinFunction.BuiltinMethodCaller`2.Call1(CallSite
site, CodeContext context, TFuncType func, T0 arg0)<br>
at
IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame
frame)<br>
at
Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)<br>
at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0
arg0)<br>
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)<br>
at IronPython.Compiler.RuntimeScriptCode.Run(Scope scope)<br>
at IronPython.Hosting.PythonCommandLine.RunFileWorker(String
fileName)<br>
at IronPython.Hosting.PythonCommandLine.RunFile(String fileName)<br>
<br>
--<br>
-- Lukáš<o:p></o:p></p>
</div>
</div>
</body>
</html>