简体   繁体   中英

OSError: [Errno 2] No such file or directory with python2.7/subprocess.py

I am trying to use a Python scrip that converts Latex to a png . The library is at https://github.com/cptdeadbones/pytex2png .

When I run the command python examples.py I get the following error:

Traceback (most recent call last):
  File "./examples.py", line 14, in <module>
    main()
  File "./examples.py", line 11, in main
    pytex2png.convert("examples/"+file,"output/"+file+".png")
  File "/Users/kekearif/Desktop/pytex2png-master/pytex2png.py", line 44, in convert
    make_transparent_bg(output,display)
  File "/Users/kekearif/Desktop/pytex2png-master/pytex2png.py", line 31, in make_transparent_bg
    exe_command(command_line)
  File "/Users/kekearif/Desktop/pytex2png-master/pytex2png.py", line 11, in exe_command
    p = subprocess.Popen(args,stdout=subprocess.PIPE)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory'

What does this error mean? Is it an error in how the arguments are being passed?

From the source:

def exe_command(cmd, display=False):
    args = shlex.split(cmd)
    if(display):
        p = subprocess.Popen(args)
    else:
        p = subprocess.Popen(args,stdout=subprocess.PIPE)
    p.wait() 

Is there a mistake in the function above?

I hope you have followed the Usage as describe here : Usage which create Makefile.

Have you check the Disclaimers ?? It says the following :

This code was devloped and tested on a Linux based system. I have no idea if it will work on another system. If you have tested it on another system, please let me know.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM