shutil - Python error: path is not recognized as an internal or external command, operable program or batch file -


import sys import os import shutil   def main(argv):     if len(argv) < 3:         print("to few arguments")         return 1     dir = os.path.dirname(__file__)     latencymonitordir = argv[1]     feedmanagerdir = argv[2]      if not os.path.exists(dir + r"\data"):         os.makedirs(dir + r"\data")     if not os.path.exists(dir + r"\data\result"):         os.makedirs(dir + r"\data\result")      scriptcommand = "\"" + dir + "\\script.py\" " + latencymonitordir     os.system(scriptcommand)     if not os.path.isfile("\"" + dir + "\\data\\boostedfeedmanager.exe\""):         shutil.copy(feedmanagerdir + r"\boostedfeedmanager.exe", dir + "\data")      scriptcommand = "\"" + dir + "\\data\\boostedfeedmanager.exe\" " + "\"" + dir + "\\data\\configinstruments.json\""     print("debug")     print(scriptcommand)     os.system(scriptcommand)  # error     return 0   if __name__ == "__main__":     sys.exit(main(sys.argv)) 

it makes error:

path not recognized internal or external command, operable program or batch file. 

this error emerges when don't add quotes path, i'm doing it. place of error marked commend "#error".

from documentation

execute command (a string) in subshell. implemented calling standard c function system(), , has same limitations. changes sys.stdin, etc. not reflected in environment of executed command.

because if error, path doesnt exist, or not command/program. try os.path.exist(scriptcommand) if exist.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -