1

I have a CherryPy service that executes an .exe utility when called. The utility accepts command line arguments and I use using subprocess.call() method like below to execute it.

import os
import subprocess

arguments = ['utility.exe' ,'/swtich1','/switch2', 'filea.csv','fileb.csv','outputfile.csv' ]

subprocess.call(arguments)

The utility creates 'outputfile.csv' file using the 'filea.csv','fileb.csv' file as input.

This works fine when the service is run directly using cherryPy.

But when the script is integrated to Apache using mod-wsgi, the utility do not produce correct output. The utility creates the output file, but the data within it is not correct.

Am I missing anything here.

Sam Rohn
  • 359
  • 2
  • 5
  • 13
  • can you share the correct/incorrect data? – Jean-François Fabre Jan 24 '17 at 15:16
  • The input file to utility have .alm extension and are encrypted. I mentioned it as csv for not to confuse. The utility is used to decrypt it. Usually data data goes missing when input arguments are not passed correctly to the utility. Could there be a any difference when arguments are passed in when run directly in cherryPy and mod_wsgi. – Sam Rohn Jan 24 '17 at 15:34
  • Not understanding the use case here but I think its very dangerous to run an exe from web server, its better to have crontab job running and checking some flag and then change the flag from webserver request. Just an work around. – Snehal Parmar Jan 24 '17 at 17:17
  • 1
    It might be running in a different security context, depending on how CherryPy and/or Apache are configured? Perhaps try running `whoami /all` from both contexts and see whether there are any differences. – Harry Johnston Jan 24 '17 at 22:31

0 Answers0