15

I have a flask web app that is published on azure. In my project I have a 'senna-win32.exe' that takes in input and sends out some output. My code for calling this .exe looks like this:

 senna_path = 'senna-win32.exe'
 p = subprocess.Popen(senna_path,stdout=subprocess.PIPE,stdin=subprocess.PIPE, stderr=subprocess.PIPE)
 stdout = p.communicate(input=bytes(userInput, 'utf-8'))[0]
 inList = stdout.decode()

It seems to work on my local pc, but on azure, it doesn't raise any issues but does nothing.

Can I not execute .exe file on azure? It is a web app and not a cloud service, I'm really trying to avoid the web/worker roles since .exe doesn't do whole lot of processing.

Tony Babarino
  • 3,355
  • 4
  • 32
  • 44
scorpion5211
  • 1,020
  • 2
  • 13
  • 33
  • It seems to be duplicate to http://stackoverflow.com/questions/41785517/publishing-flask-web-app-on-azure. Could you point out their difference? Did you put the `data` & `hash` directory into the same path of `senna-win32.exe` on Azure WebApp? – Peter Pan Jan 30 '17 at 08:25
  • On that link the issues was that the app was published incorrectly and was causing IIS errors. In this case there is no errors its simply just doesnot do anything when executing senna-win32.exe when it should be recieving some result back. I did check for data&hash directories and they are indeed in the same path as senna-win32.exe. My thought was is it even possible to run .exe under web app without doing web/worker role? – scorpion5211 Jan 30 '17 at 15:37
  • [Here is an answer](http://stackoverflow.com/questions/28293505/process-start-in-azure-website) to a question that discusses .exe execution on Azure. It appears there are some restrictions for what the .exe can do but exactly those restrictions are is not clear to me. It would be great to have some definitive documentation around this from Microsoft. – ajbeaven Mar 12 '17 at 05:19
  • What happens when you call this exe from an Azure function, as described here? http://anthonychu.ca/post/azure-functions-scheduled-executables/ – Bernard Vander Beken Mar 16 '17 at 12:16
  • 2
    strerr might have the reason, might we worth redirecting it to logs. Also, consider using webjobs (they can run as part of the same webapp so no additional cost and provide better diagnostics - status, logs etc) – AVS Mar 16 '17 at 12:36
  • I recently experienced similar problem to get a .exe from a python script (https://stackoverflow.com/questions/45734926/build-a-exe-for-windows-from-a-python-3-script-importing-pyqtgraph-and-opening, https://stackoverflow.com/questions/45750676/build-a-exe-for-windows-from-a-python-3-script-importing-pyqtgraph-and-opening, https://stackoverflow.com/questions/44516039/how-to-build-exe-for-python-3-5-3-6-if-possible). Do you think it is linked ? did you get any improvement ? – Stéphane Aug 23 '17 at 12:28

1 Answers1

1

As ajbeaver mentioned, you can start exes in an azure web app but there are some restrictions (not clearly documented). Process.Start in Azure Website

I'd enable application logging and also see if you can capture the stderr from your exe and write that to the diagnostic log. https://learn.microsoft.com/en-us/azure/app-service/web-sites-enable-diagnostic-log