<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>can you elaborate why you need access to iface? In most cases
      there are different ways that help you keep the algorithm modular
      and portable by specifying required components via parameters or
      acquiring them from the processing context.</p>
    <p>Best regards</p>
    <p>Matthias<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 07/09/2018 09:58 AM, Jean-Baptiste
      Desbas wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJJa5yA1XYZ4RAkFhDCS96gRHRbqMR8ssW1TDufnTyGh01qoyw@mail.gmail.com">
      <div dir="ltr">
        <div>Hello,</div>
        <div><br>
        </div>
        <div>What is the proper way to access iface in a processing alg
          ?</div>
        <div><br>
        </div>
        <div>I try "from qgis.utils import iface" but it crash when i
          make an iface.pushWarning.</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div><br>
        </div>
        <div>Here is the stack trace : <br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
          <br>
          *Crash ID*: 59968a8cbec4e3d98bbe532ada707149cd7f9eee<br>
          <br>
          <br>
          *Stack Trace*<br>
          <pre><br>
          QgsCustomization::preNotify :<br>
          QObject::event :<br>
          QApplicationPrivate::notify_helper :<br>
          QApplication::notify :<br>
          QgsApplication::notify :<br>
          QCoreApplication::notifyInternal2 :<br>
          QCoreApplicationPrivate::sendPostedEvents :<br>
          qt_plugin_query_metadata :<br>
          QEventDispatcherWin32::processEvents :<br>
          CallWindowProcW :<br>
          DispatchMessageW :<br>
          QEventDispatcherWin32::processEvents :<br>
          qt_plugin_query_metadata :<br>
          QEventLoop::exec :<br>
          QDialog::exec :<br>
          PyCFunction_FastCallDict :<br>
          PyObject_GenericGetAttr :<br>
          PyEval_EvalFrameDefault :<br>
          PyFunction_FastCallDict :<br>
          PyObject_CallFunctionObjArgs :<br>
          PyObject_Call :<br>
          PyInit_QtCore :<br>
          PyInit_QtCore :<br>
          PyInit_QtCore :<br>
          PyInit_QtCore :<br>
          PyInit_QtCore :<br>
          QMetaObject::activate :<br>
          QAbstractItemView::doubleClicked :<br>
          QTreeView::mouseDoubleClickEvent :<br>
          QWidget::event :<br>
          QFrame::event :<br>
          QAbstractItemView::viewportEvent :<br>
          QCoreApplicationPrivate::sendThroughObjectEventFilters :<br>
          QApplicationPrivate::notify_helper :<br>
          QApplication::notify :<br>
          QgsApplication::notify :<br>
          QCoreApplication::notifyInternal2 :<br>
          QApplicationPrivate::sendMouseEvent :<br>
          QSizePolicy::QSizePolicy :<br>
          QSizePolicy::QSizePolicy :<br>
          QApplicationPrivate::notify_helper :<br>
          QApplication::notify :<br>
          QgsApplication::notify :<br>
          QCoreApplication::notifyInternal2 :<br>
          QGuiApplicationPrivate::processMouseEvent :<br>
          QWindowSystemInterface::sendWindowSystemEvents :<br>
          QEventDispatcherWin32::processEvents :<br>
          CallWindowProcW :<br>
          DispatchMessageW :<br>
          QEventDispatcherWin32::processEvents :<br>
          qt_plugin_query_metadata :<br>
          QEventLoop::exec :<br>
          QCoreApplication::exec :<br>
          main :<br>
          BaseThreadInitThunk :<br>
          RtlUserThreadStart :<br>
          </pre><br>
          <br>
          <br>
          *QGIS Info*<br>
          QGIS Version: 3.2.0-Bonn<br>
          QGIS code revision: commit:bc43194061<br>
          Compiled against Qt: 5.9.2<br>
          Running against Qt: 5.9.2<br>
          Compiled against GDAL: 2.2.4<br>
          Running against GDAL: 2.2.4<br>
          <br>
          <br>
          <br>
          *System Info*<br>
          CPU Type: x86_64<br>
          Kernel Type: winnt<br>
          Kernel Version: 10.0.17134<br>
          <br>
        </div>
      </div>
      <!--'"--><br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div class="moz-signature">
        <title></title>
        <div class="moz-signature"> <span style="text-align: left;
            color: #000000; font-family: 'Verdana', sans-serif;
            font-size: 10pt">Matthias Kuhn</span><br>
          <a href="mailto:matthias@opengis.ch" target="_blank"> <span
              style="text-align: left; color: #000000; font-family:
              'Verdana', sans-serif; font-size: 8pt">matthias@opengis.ch</span>
          </a><br>
          <span style="text-align: left; color: #000000; font-family:
            'Verdana', sans-serif; font-size: 8pt"><a
              href="tel:+41764356763">+41 (0)76 435 67 63</a></span><br>
          <div> <a href="http://www.opengis.ch"> <img
                moz-do-not-send="false"
                src="cid:part3.0FCD1365.B6FD06EB@opengis.ch"
                alt="OPENGIS.ch Logo" width="200" height="80"></a> </div>
        </div>
      </div>
    </div>
  </body>
</html>