The following code works as expected:
Qt Code:
  1. dialog = QFileDialog(self)
  2. dialog.setFileMode(QFileDialog.Directory)
  3. if dialog.exec():
  4. save_folder = dialog.selectedFiles()
To copy to clipboard, switch view to plain text mode 
However, changing the file mode and adding a filter causes the exec call to fail:

Qt Code:
  1. image_dialog = QFileDialog(self)
  2. image_dialog.setFileMode(QFileDialog.ExistingFiles)
  3. image_dialog.setNameFilter("Images (*.png *.jpg *.pgm)")
  4. if image_dialog.exec():
  5. filename = image_dialog.selectedFiles()
To copy to clipboard, switch view to plain text mode 

Any Idea why this might be the case? Both code snippets reside in the same slot function within the main window class, and this behavior seems to be consistent no matter where In the program I move them to.