From 33c5bd874b0294b9a0828bd4cfb98dda4ed7f7dc Mon Sep 17 00:00:00 2001 From: greerdv Date: Wed, 9 Jun 2021 18:19:28 +0100 Subject: [PATCH] fix handling of multiple arguments running python scripts from console --- .../EditorPythonBindings/Code/Source/PythonSystemComponent.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gems/EditorPythonBindings/Code/Source/PythonSystemComponent.cpp b/Gems/EditorPythonBindings/Code/Source/PythonSystemComponent.cpp index 38660fce02..00dbca12c9 100644 --- a/Gems/EditorPythonBindings/Code/Source/PythonSystemComponent.cpp +++ b/Gems/EditorPythonBindings/Code/Source/PythonSystemComponent.cpp @@ -718,7 +718,8 @@ namespace EditorPythonBindings for (int arg = 0; arg < args.size(); arg++) { - argv[arg + 1] = Py_DecodeLocale(args[arg].data(), nullptr); + AZStd::string argString(args[arg]); + argv[arg + 1] = Py_DecodeLocale(argString.c_str(), nullptr); } // Tell Python the command-line args. // Note that this has a side effect of adding the script's path to the set of directories checked for "import" commands.