[Paraview] finding cwd of python script via __file__

m.c.wilkins at massey.ac.nz m.c.wilkins at massey.ac.nz
Sun Oct 17 22:53:53 EDT 2010


Hi,

A while ago I had a problem in my python plugin of trying to determine
the current working directory of the script.  Pat solved the problem
by patching the method

   void pqPythonDialog::runScript(const QStringList& files)

in

   Qt/Python/pqPythonDialog.cxx

so it had this in it:

   if(file.open(QIODevice::ReadOnly))
      {
      this->runString(QString("__file__ = \"%1\"").arg(files[i]));
      this->runString(file.readAll().data());
      }

I don't think this made it into the main paraview repo.  Is it
possible for this patch to go in?

Thanks

Matt



More information about the ParaView mailing list