2017年3月28日星期二

IronPython clr.AddReferenceToFile Error

 问题:在脚本中可以执行,但在交互解释器中出错。

 IronPython Tutorial
clr.AddReferenceToFile adds reference to the assembly specified by its file name. This function will load the assembly from the file regardless of the assembly version. As a result, it doesn't guarantee that the correct assembly version is being loaded. To guarantee that correct assembly version is being loaded, use clr.AddReferenceByName. Moreover, AddReferenceToFile requires that the assembly be located in a directory listed in sys.path.

how-to-use-a-c-sharp-dll-in-ironpython

import sys
import os

sys.path.insert(0, os.getcwd())


将脚本编译为可执行文件:
ipyc.exe /main:ymmj.py ymmj.py /platform:x64 /target:exe /standalone

没有评论: