我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用osgeo.gdal.PopErrorHandler()。
def translate(self, params): if params is None: return params['callback'] = self.translate_callback dlg = QProgressDialog(self) dlg.setWindowTitle(plugin_name()) dlg.setLabelText('Operation in progress') dlg.setMinimum(0) dlg.setMaximum(100) dlg.setWindowModality(Qt.WindowModal) self.progress_dlg = dlg self.setCursor(Qt.WaitCursor) try: log("gdal.VectorTranslate({})".format(str(params))) gdal.PushErrorHandler(gdal_error_handler) with qgis_proxy_settings(): res = gdal.VectorTranslate(**params) gdal.PopErrorHandler() log(str(res)) finally: self.unsetCursor() self.progress_dlg.reset() self.progress_dlg = None