首页 > 解决方案 > 'hskip' 未被识别为内部或外部命令,

问题描述

cmd = "perl -pe 's|hskip(.*?)(cm\\|in\\|pt\\|mm\\|em)|hspace{\\1\\2}|g' %s > %s"%(input_file, 
output_file)
ret = subprocess.call(cmd, shell=True)
if ret != 0:
   logging.error('FAILED: %s'%cmd)

错误输出:

'hskip' is not recognized as an internal or external command,
operable program or batch file.
2021-02-21 16:39:46,454 root  ERROR    FAILED: perl -pe 's|hskip(.*?)(cm\|in\|pt\|mm\|em)|hspace{\1\2}|g' .\data\sample\im2latex_formulas.lst > .\data\sample\formul`as.norm.lst     
2021-02-21 16:39:46,457 root  INFO  Jobs finished**

标签: pythonshellcmd

解决方案


如果你在 Windows 上,你应该使用双引号而不是单引号:

例如:

cmd = 'perl -pe "s|hskip|hspace|g" in.txt > out.txt'
ret = subprocess.call(cmd, shell=True)

也可以看看:


推荐阅读