• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Is there a way to send a string to external python program?

O

ocnuybear

Guest
I want to use Python for neural learning as it has very good libraries for it, so my idea is that GM2 send out strings to Python program and Python can control GM2 via key press events.
 
O

ocnuybear

Guest
So far all I've got is to use ExecuteShell extension, but it is not starting Python - can someone please help?

Code:
ExecuteShell("C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe",true);
 
O

ocnuybear

Guest
Got it working with the help of Samuel Venable:

Code:
ExecuteShell(@'"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe" "C:\Program Files (x86)\Python Scripts\example.py"',true);
 

Yal

šŸ§ *penguin noises*
GMC Elder
Got it working with the help of Samuel Venable:

Code:
ExecuteShell(@'"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe" "C:\Program Files (x86)\Python Scripts\example.py"',true);
Don't forget that you might wanna add logic to ensure python IS installed, and on that location, before you make a release build of the game. You probably would want to replace localization-prone hardcoded paths like "Program Files (x86)" with the appropriate environment variables, too.
 
Top