11 #include "vtkLogger.h" 16 #include "vtkPythonInterpreter.h" 23 #include <vtksys/SystemTools.hxx> 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[])
89 std::vector<char*> pythonArgs;
91 pythonArgs.push_back(
nullptr);
93 const char* programName =
nullptr;
98 #if !defined(__APPLE__) 102 vtkPythonInterpreter::InitializeWithArgs(
103 1, static_cast<int>(pythonArgs.size()) - 1, &pythonArgs.front(), programName);
115 vtkLogF(ERROR,
"No script specified. Please specify a batch script or use 'pvpython'.");
136 vtkPythonInterpreter::SetLogVerbosity(
137 pmConfig->GetLogStdErrVerbosity() != vtkLogger::VERBOSITY_INVALID
138 ? vtkLogger::VERBOSITY_INFO
139 : vtkLogger::VERBOSITY_TRACE);
142 vtkPythonInterpreter::PyMain(static_cast<int>(pythonArgs.size()) - 1, &pythonArgs.front());
147 if (iter->IsDoneWithTraversal())
154 for (
auto& ptr : pythonArgs)
static vtkProcessModuleConfiguration * GetInstance()
Provides access to the singleton.
void LoadPluginConfigurationXMLs(const char *appname)
Called to load application-specific configuration xml.
vtkSessionIterator * NewSessionIterator()
Returns a new session iterator that can be used to iterate over the registered sessions.
static int GetExitCode()
Returns the exit code after Initialize.
static vtkCLIOptions * New()
int GetPartitionId()
Returns the local process id.
int ProcessRMIs(int reportErrors, int dont_loop=0)
static bool GetSymmetricMPIMode()
static bool InitializeOthers()
Initialize everything that is not initialized by specific methods, see Initialize method for more inf...
static void Finalize()
Finalizes the server manager.
static vtkProcessModule * GetProcessModule()
Provides access to the global ProcessModule.
static bool InitializeSettings(int type, bool defaultCoreConfig)
Initialize the setting by reading the settings file, unless coreConfig DisableRegistry is set to true...
static vtkIdType ConnectToSelf()
These are static helper methods that help create standard ParaView sessions.
static void SetApplicationName(const std::string &appName)
Sets the name of the application.
void ProcessArgsForPython(std::vector< char *> &pythonArgs, const std::vector< std::string > &args, int vtkNotUsed(argc), char **argv)
static vtkPVPluginTracker * GetInstance()
Provides access to the singleton.
vtkMultiProcessController * GetGlobalController()
Provides access to the global MPI controller, if any.
const std::string & GetProgramPath() const
The full path to the current executable that is running (or empty if unknown).
int Run(int processType, int argc, char *argv[])
void vtkPVInitializePythonModules()
static void ParaView_paraview_plugins_initialize()
static bool InitializeOptions(int argc, char **argv, int processType, vtkCLIOptions *options=nullptr, bool enableStandardArgs=true)
Initialize the process module and options of ParaView engine.
process initialization and management core for ParaView processes.
bool UnRegisterSession(vtkIdType sessionID)
Unregister a session given its ID.