0
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)

Error output:

'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**
ikegami
  • 367,544
  • 15
  • 269
  • 518

1 Answers1

3

If you are on Windows, you should use double quotes instead of single quotes:

For example:

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

See also:

Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174