[PyQt] PyQt QFileDialog works in Linux, not on Mac

John Ladasky jladasky at itu.edu
Wed Jul 19 00:30:24 BST 2017


Hello everyone,

I wrote a PyQt5 application that used to work on both Linux (Ubuntu 16.04
and 17.04), and on Mac (OS X 10.9).  Our IT department recently upgraded
our Mac laptops to Sierra (OS X 10.12.5).  This appears to have broken my
program on the Mac. I have reduced the problem to a minimal example.
Attempting to set the Accept Mode on the QFileDialog makes it fail to
render.  Here is the code:

import sys
from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog

class MainWindow(QWidget):

    def __init__(self):
        super().__init__()
        self.show()
        dialog = QFileDialog(self)
        dialog.setAcceptMode(QFileDialog.AcceptSave)  # <-- Problem is here
        dialog.show()

app = QApplication(sys.argv)
w = MainWindow()
sys.exit(app.exec_())


Of course, the QFileDialog is useless if I can't actually use it...  If
anyone has any suggestions or recommendations, I would greatly appreciate
them.  Thanks!

-- 
*John J. Ladasky Jr., Ph.D.*
*Research Scientist*
*International Technological University*
*2711 N. First St, San Jose, CA 95134 USA*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170718/0e96b0d6/attachment.html>


More information about the PyQt mailing list