I am trying to access a path variable using python.
Subprocess.call & Subprocess.Popen seem unable to do so, despite the fact that the Exe's location is in my PATH Variables, and can be run from cmd.exe I can also run this with an absolute path to the executable, but this isn't desirable.
Managed to find this article: Subprocess.call or Subprocess.Popen cannot use executables that are in PATH (Linux/Windows)
But their solution to grab the environment variables and use them didn't work for me.
import os
import subprocess
environment_vars = os.environ
input_image_location = 'D:/python/images/test_image.bmp'
output_image_location = 'D:/python/images/test_image_output.ps'
cmd_args = ["potrace", "-p", input_image_location, "-o",output_image_location]
proc = subprocess.Popen(cmd_args, env=environment_vars)
But this is erroring with:
File "C:Python27\lib\subprocess.py", line 958, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Any tips on how to get this to work?