Hi,

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.

Best regards

Matthias


On 07/09/2018 09:58 AM, Jean-Baptiste Desbas wrote:
> Hello,
>
> What is the proper way to access iface in a processing alg ?
>
> I try "from qgis.utils import iface" but it crash when i make an
> iface.pushWarning.
>
> Thanks,
>
> Here is the stack trace :
>
>
>
>
> *Crash ID*: 59968a8cbec4e3d98bbe532ada707149cd7f9eee
>
>
> *Stack Trace*
> <pre>
> QgsCustomization::preNotify :
> QObject::event :
> QApplicationPrivate::notify_helper :
> QApplication::notify :
> QgsApplication::notify :
> QCoreApplication::notifyInternal2 :
> QCoreApplicationPrivate::sendPostedEvents :
> qt_plugin_query_metadata :
> QEventDispatcherWin32::processEvents :
> CallWindowProcW :
> DispatchMessageW :
> QEventDispatcherWin32::processEvents :
> qt_plugin_query_metadata :
> QEventLoop::exec :
> QDialog::exec :
> PyCFunction_FastCallDict :
> PyObject_GenericGetAttr :
> PyEval_EvalFrameDefault :
> PyFunction_FastCallDict :
> PyObject_CallFunctionObjArgs :
> PyObject_Call :
> PyInit_QtCore :
> PyInit_QtCore :
> PyInit_QtCore :
> PyInit_QtCore :
> PyInit_QtCore :
> QMetaObject::activate :
> QAbstractItemView::doubleClicked :
> QTreeView::mouseDoubleClickEvent :
> QWidget::event :
> QFrame::event :
> QAbstractItemView::viewportEvent :
> QCoreApplicationPrivate::sendThroughObjectEventFilters :
> QApplicationPrivate::notify_helper :
> QApplication::notify :
> QgsApplication::notify :
> QCoreApplication::notifyInternal2 :
> QApplicationPrivate::sendMouseEvent :
> QSizePolicy::QSizePolicy :
> QSizePolicy::QSizePolicy :
> QApplicationPrivate::notify_helper :
> QApplication::notify :
> QgsApplication::notify :
> QCoreApplication::notifyInternal2 :
> QGuiApplicationPrivate::processMouseEvent :
> QWindowSystemInterface::sendWindowSystemEvents :
> QEventDispatcherWin32::processEvents :
> CallWindowProcW :
> DispatchMessageW :
> QEventDispatcherWin32::processEvents :
> qt_plugin_query_metadata :
> QEventLoop::exec :
> QCoreApplication::exec :
> main :
> BaseThreadInitThunk :
> RtlUserThreadStart :
> </pre>
>
>
> *QGIS Info*
> QGIS Version: 3.2.0-Bonn
> QGIS code revision: commit:bc43194061
> Compiled against Qt: 5.9.2
> Running against Qt: 5.9.2
> Compiled against GDAL: 2.2.4
> Running against GDAL: 2.2.4
>
>
>
> *System Info*
> CPU Type: x86_64
> Kernel Type: winnt
> Kernel Version: 10.0.17134
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
Matthias Kuhn
matth...@opengis.ch <mailto:matth...@opengis.ch>
+41 (0)76 435 67 63 <tel:+41764356763>
OPENGIS.ch Logo <http://www.opengis.ch>
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to