11 #include "vtkLogger.h"
16 #include "vtkPythonInterpreter.h"
23 #include <vtksys/SystemTools.hxx>
25 #include "ParaView_paraview_plugins.h"
33 const std::vector<std::string>& args,
int vtkNotUsed(argc),
char** argv)
38 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(argv[0]));
48 if (vtksys::SystemTools::GetFilenameLastExtension(args[0]) ==
".zip")
51 vtkPythonInterpreter::PrependPythonPath(args[0].c_str());
52 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(
"-m"));
54 std::string modulename = vtksys::SystemTools::GetFilenameWithoutLastExtension(
55 vtksys::SystemTools::GetFilenameName(args[0]));
56 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(modulename.c_str()));
60 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(args[0].c_str()));
63 for (
size_t cc = 1,
max = args.size(); cc <
max; ++cc)
65 pythonArgs.push_back(vtksys::SystemTools::DuplicateString(args[cc].c_str()));
70 inline int Run(
int processType,
int argc,
char* argv[])
87 std::vector<char*> pythonArgs;
89 pythonArgs.push_back(
nullptr);
90 vtkPythonInterpreter::InitializeWithArgs(
91 1,
static_cast<int>(pythonArgs.size()) - 1, &pythonArgs.front());
102 vtkLogF(ERROR,
"No script specified. Please specify a batch script or use 'pvpython'.");
109 ParaView_paraview_plugins_initialize();
125 vtkPythonInterpreter::SetLogVerbosity(
126 pmConfig->GetLogStdErrVerbosity() != vtkLogger::VERBOSITY_INVALID
127 ? vtkLogger::VERBOSITY_INFO
128 : vtkLogger::VERBOSITY_TRACE);
131 vtkPythonInterpreter::PyMain(
static_cast<int>(pythonArgs.size()) - 1, &pythonArgs.front());
136 if (iter->IsDoneWithTraversal())
143 for (
auto& ptr : pythonArgs)