Hi cammunity,
I am attempting to call a Python script stored in my local storage from FlexSim using the script below. However, I am encountering errors related to calling external commands and handling messages. I would appreciate any help or suggestions on how to resolve these issues and successfully execute the Python script from FlexSim.
// Define the path to Python and the Python script
string pythonExePath = "Storage Path"; // Path to Python executable
string scriptPath = "Storage Path"; // Path to your Python script
// Prepare the command to run
string command = pythonExePath + " \"" + scriptPath + "\""; // Make sure to handle spaces in paths
// Run the command using callExternal()
int result = callExternal(command);
// Check the result to see if the script was called successfully
if (result == 0)
{
message("SMS sent successfully!");
}
else
{
message("Failed to send SMS. Error code: " + result);
}
Thanks in advance for your assistance!