2

My python interpreter is failing to load this specific module. The following exception is being thrown:

Starting interpreter...
Running file 'C:\Berkeley Lights\CellAnalysisSuite\Scripts\New Text Document.py'
Traceback (most recent call last):
  Line 2, in <module>
IOError: System.IO.IOException: Could not add reference to assembly IronPython.Modules.dll
   at IronPython.Runtime.ClrModule.AddReferenceToFile(CodeContext context, String file)
   at IronPython.Runtime.ClrModule.AddReferenceToFile(CodeContext context, String[] files)
   at Microsoft.Scripting.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   at CellAnalysisSuite.Framework.Common.PythonInterpreter.RunThread() in C:\TFS\Branches\CellAnalysisSuite\Framework\Common\PythonInterpreter.cs:line 463

and here is "New Text Document.py":

import clr 
clr.AddReferenceToFile("IronPython.Modules.dll")

Environment:

  • Win10Pro
  • IronPython 2.7
  • .NET 4.6.2
  • Interpreter launched from C#/WinForms application

1 Answer 1

2

The problem has been identified as the python interpreter used in our GUI not being the same as the interpreter that was installed on the local system. An internal developer switched the library references over to be internally distributed DLLs to reduce the requirement for end users to have python installed on their own system. Once the required module was referenced from inside of our project and the import was removed from the script, we were able to access the module listed above.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.