这可能是一个愚蠢的问题。
我正在试验 python doctest,我尝试运行这个例子
以
if __name__ == "__main__":
import doctest
doctest.testfile("example.txt")
我已将“example.txt”与包含示例代码的源文件放在同一文件夹中,但出现以下错误:
Traceback (most recent call last):
File "test_av_funktioner.py", line 61, in <module>
doctest.testfile("example.txt")
File "C:\Python26\lib\doctest.py", line 1947, in testfile
text, filename = _load_testfile(filename, package, module_relative)
File "C:\Python26\lib\doctest.py", line 219, in _load_testfile
return open(filename).read(), filename
IOError: [Errno 2] No such file or directory: 'example.txt'
我可以以某种方式告诉/设置 doctest 模块在哪里搜索指定的文件吗?