SOLVED Subprocess module in Robofont



  • Hello RoboUsers!

    I would like to use the subprocess python module in Robofont.
    If I launch the following script from sublime/terminal:

    import subprocess
    subprocess.call(['vfb2ufo', 'font.ufo'])
    

    this is the output that I receive:

    VFB2UFO Converter
    Copyright (c) 2013-2015 by Fontlab Ltd.
    Build 2015-01-23
    

    Otherwise, launching the same file from Robofont, I receive this output:

    Traceback (most recent call last):
      File "test_subprocess.py", line 2, in <module>
      File "subprocess.pyc", line 524, in call
      File "subprocess.pyc", line 711, in __init__
      File "subprocess.pyc", line 1308, in _execute_child
    OSError: [Errno 2] No such file or directory
    

    There seems to be a problem related to paths, but using something like:

    os.path.join(os.getcwd(), ‘font.ufo’)
    

    doesn’t fix the problem.

    Any tips?
    Actually I’d like to use the vfb2ufo tool someway, so if there’s an alternative to subprocess module is of course welcome.

    Thanks



  • Solved:

    from mojo.compile import executeCommand
    print executeCommand(['vfb2ufo', 'font.ufo'], shell=True)
    

  • admin

    yep, using executeCommand solves your issue when shell is set to True



  • Solved:

    from mojo.compile import executeCommand
    print executeCommand(['vfb2ufo', 'font.ufo'], shell=True)