简体   繁体   中英

ipython notebook & script difference - loading DLLs

Did anyone notice the difference in loading .NET dlls between IPython/Jupyter notebook/(qt)console and normal python scripts using pythonnet?

Is this a bug/behavior caused on pythonnet or ipython side?

This works in ipython and python interactive console:

import clr
clr.AddReference(r"C:\path2dll\dotnetdll")

But in regular python scripts, the sys.path has to be appended with the path to DLL:

import clr
import sys
sys.path.append(r"C:\path2dll")
clr.AddReference("dotnetdll")

Possibly similar problem:

Permission denied on dl.open() with ipython but not with python

in interactive mode python interpreter appends empty string "" to sys.path . As a side effect of this the buggy AssemblyManager in pythonnet was loading assemblies from full path only in interpreter mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM