我一直在尝试让Iron Python引用文件,但似乎找不到或无法识别它。我从此命令开始,收到一条错误消息。
我知道Windows中的反斜杠存在问题,因此我继续进行此错误消息后列出的一些实验。
sys.path.append(r“ C:\ Program Files \ Bosch Sensortec \ Development Desktop 2.0 \ UserpApplicationBoard”)
clr.AddReference('UserApplicationBoard.dll')
回溯(最近通话最近): 文件“”,第1行,位于 IOError:System.IO.IOException:无法添加对程序集的引用>>> UserApplicationBoard.dll 在IronPython.Runtime.ClrModule.AddReference(CodeContext上下文,字符串>名称) 在IronPython.Runtime.ClrModule.AddReference(CodeContext上下文,Object []>引用) 在> Microsoft.Scripting.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame> frame) 在Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame框架) 在Microsoft.Scripting.Interpreter.LightLambda.Run4 [T0,T1,T2,T3,TRet](T0> arg0,T1 arg1,T2 arg2,T3 arg3) 在System.Dynamic.UpdateDelegates.UpdateAndExecute3 [T0,T1,T2,TRet](CallSite>站点,T0 arg0,T1 arg1,T2 arg2) 在> IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame> frame) 在Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame框架) 在Microsoft.Scripting.Interpreter.LightLambda.Run2 [T0,T1,TRet](T0 arg0,T1> arg1) 在IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) 在IronPython.Hosting.PythonCommandLine。<> c__DisplayClass1中。 b__0()
因此,我测试了该路径,该路径似乎可行,但是当我尝试该文件时说该文件不存在。我用反斜杠,双反斜杠和正斜杠进行了几种尝试。
os.path.exists('C:\ Program Files \ Bosch Sensortec \ Development Desktop 2.0 \ UserpApplicationBoard') 是
os.path.isfile('C:\ Program Files \ Bosch Sensortec \ Development Desktop> 2.0 \ UserApplicationBoard.dll') 错误
os.path.exists('C:\\ Program Files \\ Bosch Sensortec \\ Development Desktop 2.0') 是
os.path.isfile('C:\\ Program Files \\ Bosch Sensortec \\ Development Desktop 2.0 \\ UserApplicationBoard.dll') 错误
os.path.isfile('C:/ Program Files / Bosch Sensortec / Development Desktop 2.0 / UserApplicationBoard.dll') 错误
感谢您的帮助。
谢谢