"'$arg'", $args)); // prepare arguments for use on command line $python_cmd = "bash $ws" . DIRECTORY_SEPARATOR . "py_exec.sh \"$ws" . DIRECTORY_SEPARATOR . $script . "\" " . $flattened_args . " 2>&1"; return shell_exec($python_cmd); // execute python script } }