问题描述
所以,我的脚本如下:
from myLibrary import *
import time
#parameter assignment
f=0
#re-naming of an other method (myMainMethod) from myLibrary to call it inside of myFunct
myClass.myOldMethod = myClass.myMainMethod
@classmethod
def myFunct(self,f):
"""docstring for my function"""
myClass.myOldMethod(f)
print("...")
#(added lines with other instructions)
#substitution of function with myFunct outside of defining block to "update" main method
myClass.MainMethod = myFunct
我的modules.rst文件如下:
.. toctree::
:maxdepth: 4
myScript
myScript2
myScript3
myScript4
myMainMethod是myLibrary中的类(myClass)的方法,我无权访问(属于许可程序的一部分)。 我如何在sphinx上包含文档字符串,因为当我尝试从cmd提示符(sphinx-build -b html .html)构建html时,会收到类似
的消息警告:... 文件myClass.myOldMethod = myClass.myMainMethod
中的文件“ C:\ Users \ Sphinx_Folder \ myScript.py”
NameError:名称'myClass'未定义
myClass类在C:... \ python37 \ Lib \ site-packages \ myLibrary中定义,如下所示:
class myClass:
@classmethod
def myMainMethod(self,f=None):
print("Method")
pass
我设置了conf.py文件,以便模拟导入是否成功,并发现它无法识别myLibrary中的任何模块。 这是我添加到conf.py中的行,以便它可以识别模块:
sys.path.insert(0,os.path.abspath('.'))
conf.py文件位于C:\ Users \ Sphinx_Folder下。问题与我的conf.py文件和abspath有关吗?如何在站点包文件夹中包含myLibrary?
谢谢您的帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)