[Qgis-user] QtWidgets.QFileDialog.getSaveFileName make qgis crash on windows 10

PLASSOT Eric e.plassot at laposte.net
Mon Mar 11 06:00:39 PDT 2024


Hi,
with qgis 3.34 with a processing script in pythonthe use of the dialog 
box QtWidgets.QFileDialog.getSaveFileNamemakes qgis crash on windows 10 
and not on windows 11.
Maybe because the dialog is initiated in C/Program Files\QGIS 3.34.4\bin 
which is a protected folder?I tried to set the document folder as 
default, but same crash.
the code :
  output_file_name = input_featuresource.sourceName() + '.kml'

output_file_path, _ = QtWidgets.QFileDialog.getSaveFileName(None, 
"Exporter les polygones au format KML",
output_file_name,
                                               "Fichiers KML (*.kml)")
I try this with the same crash when i click "Enregistrer"
  output_file_name = input_featuresource.sourceName() + '.kml'
  default_directory = os.path.join(os.path.expanduser("~"), "Documents")
output_file_path, _ = QtWidgets.QFileDialog.getSaveFileName(None, 
"Exporter les polygones au format KML",
os.path.join(default_directory,output_file_name),
                                               "Fichiers KML (*.kml)")

The crash message :

## Report Details

**Python Stack Trace**

```

Windows fatal exception: access violation

Current thread 0x000015a8 (most recent call first):

File 
"C:\Users\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\processing\scripts\exportPolygonsKMLParcellesAttributs.py", 
line 201 in exportPolygonsKMLParcellesAttributs

output_file_path, _ = QtWidgets.QFileDialog.getSaveFileName(None, 
"Exporter les polygones au format KML", output_file_name, "Fichiers KML 
(*.kml)")

File 
"C:\PROGRA~1/QGIS33~1.4/apps/qgis-ltr/./python\qgis\processing\algfactory.py", 
line 278 in processAlgorithm

output = self._func(self, parameters, context, feedback, values)

Thread 0x000021d0 (most recent call first):

File 
"C:\PROGRA~1/QGIS33~1.4/apps/qgis-ltr/./python/plugins\processing\ProcessingPlugin.py", 
line 432 in executeAlgorithm

dlg.exec_()

File 
"C:\PROGRA~1/QGIS33~1.4/apps/qgis-ltr/./python/plugins\processing\gui\ProcessingToolbox.py", 
line 232 in executeAlgorithm

self.executeWithGui.emit(alg.id(), self, self.in_place_mode, False)

```

**Stack Trace**

```

QPainter::fillRect :

QWindowsStylePrivate::devicePixelRatio :

QWindowsStylePrivate::devicePixelRatio :

QWidgetPrivate::paintBackground :

QWidgetPrivate::drawWidget :

QWidgetPrivate::moveRect :

QWidget::event :

QApplicationPrivate::notify_helper :

QApplication::notify :

QgsApplication::notify :

QCoreApplication::notifyInternal2 :

QCoreApplicationPrivate::sendPostedEvents :

QEventDispatcherWin32::processEvents :

QEventLoop::exec :

QDialog::exec :

QFileDialog::getSaveFileUrl :

QFileDialog::getSaveFileName :

PyInit_QtWidgets :

PyObject_Str :

PyEval_EvalFrameDefault :

PyFunction_Vectorcall :

PyEval_EvalFrameDefault :

PyFunction_Vectorcall :

PyObject_GC_Del :

PyVectorcall_Call :

PyObject_Call :

pdal::PointContainer::freeTemp :

pdal::Option::getName :

QgsProcessingAlgorithm::runPrepared :

QgsProcessingAlgRunnerTask::run :

pdal::Option::getName :

QgsTask::start :

QThreadPoolPrivate::reset :

QThread::start :

BaseThreadInitThunk :

RtlUserThreadStart :

```

**QGIS Info**

QGIS Version: 3.34.4-Prizren

QGIS code revision: decd43dc

Compiled against Qt: 5.15.3

Running against Qt: 5.15.3

Compiled against GDAL: 3.8.4

Running against GDAL: 3.8.4

**System Info**

CPU Type: x86_64

Kernel Type: winnt

Kernel Version: 10.0.19044
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240311/7f17efca/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2024-03-11 12_57_26-Exporter les polygones au format KML.png
Type: image/png
Size: 24621 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240311/7f17efca/attachment-0001.png>


More information about the QGIS-User mailing list