这是我的代码:
#!/usr/bin/python
import subprocess
asciidoc_file_name = '/tmp/redoc_2013-06-25_12:52:19.txt'
asciidoc_call = ["asciidoc","-b docbook45",asciidoc_file_name]
print asciidoc_call
subprocess.call(asciidoc_call)
输出如下:
^{pr2}$当通过python子进程调用时,asciidoc
会抱怨缺少配置文件。当在命令行调用时,一切正常,配置文件就在那里。有人能理解吗?我迷路了。在
试试这个:
另一个调用将使用
"-b docbook45"
作为一个单独的选项调用ascidoc,这不起作用。在这个问题很古老。。。无论如何,
asciidoc
是在Python中实现的,它还包括可以用作Python程序模块的asciidocapi.py
。模块docstring说:为了简化,它实现了
AsciiDocAPI
类,初始化时该类搜索asciidoc
脚本并将其作为模块导入场景后面。这样,您可以在Python中更自然地使用它,并且可以避免使用subprocess.call()
。在相关问题 更多 >
编程相关推荐