William Tonkin-Howe - 8 months ago 396
C# Question

# Universal Windows Platform (UWP) C# app - How to run stand alone python inside your application

I am trying to find a way to call python from my UWP app. So far I have a .exe file that I have compiled from python using pyinstaller (www.pyinstaller.org/). This basically allows me to package up my python script as a standalone binary (ie: you don't need python to run it). This all works well and I can call my wrapped up python .exe via cmd.exe no problem:

$process.exe -p "path\to\file"$ Processing file: "path\to\file"...

\$ Done.

So now I just need to call it from my UWP app - so I have added it to my application like so:

C# Project

Assets/process.exe

Frustratingly, I've not had much luck googling for answers to my problem - my attempted solutions so far have included:

• Calling the "Assets/process.exe" directly from my app

• Looked at "Launch an app and get results". I think this seams to be for external applications however... I certainly didn't get it going anyway.

• Opening the cmd.exe (somehow) and calling my process.exe from there.

I'm not even sure if I'm trying to do this the correct way or not. Or if I have just not understood some of my findings. Or (fingers crossed) there is a simple solution to this I just don't know about and have somehow missed as I'm very new to UWP development and C#.

So any solutions/pointers here would be greatly appreciated thanks!!

So there is no way to run an .exe (or any other executable) from your UWP app. If you have access to a StorageFile (say music, video or any other file format) then you can launch the file in the default program associated with that file type.