subprocess - Executing cmd commands from python program -


from subprocess import *  s=popen(['c:\python27\scripts\pyssim',"'c:\users\p\desktop\1.png'",'c:\users\p\desktop\2.png'],stderr=pipe,stdout=pipe,shell=true)  out,err=s.communicate()  print out 

the python program above executes shows no output.
nothing printed on shell.
while running command on cmd gives output "1".

your command failing because parameters being passed not think are; keep in mind backslashes treated start of escape sequences in python string literals. specifically, \1 , \2 being treated octal character escapes, rather digits. if looked @ contents of err, find file not found error. possible solutions:

  • double of backslashes, escape them.
  • put 'r' in front of each string literal, make them 'raw strings' don't specially interpret backslashes.
  • not applicable in case, can use forward slashes instead - of windows happily accept them instead of backslashes, 1 exception being command line (which you're invoking here).

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -