Hi all,
I thought clr.AddReferenceToFile should behave similarly to clr.AddReferenceToFileAndPath when I adjust sys.path manually first. But it seems they don't. Is it a bug or feature?

This works:

import clr
import sys
clr.AddReferenceToFileAndPath('..\\PythonModules.dll')

This does not work:

import clr
import sys
sys.path.insert(0, '..\\')
clr.AddReferenceToFile('PythonModules.dll')

Traceback (most recent call last):
 File "C:\tests\addrefbug.py", line 8, in <module>
IOError: System.IO.IOException: Could not add reference to assembly PythonModules.dll 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 __main__$2.__main__(FunctionCode $functionCode) in C:\Klasifikace\Klasifikace\tests\db\addrefbug.py:line 10
  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
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to