Results 1 to 3 of 3

Thread: QFileDialog.getOpenFileNames crashes the interpreter

  1. #1
    Join Date
    Jul 2020
    Posts
    5
    Thanks
    1

    Default QFileDialog.getOpenFileNames crashes the interpreter

    I'm using PyQt5 and attempting to create a dialog that allows the user to select one or more files.

    The following code functions but allows the user to select only a single file:

    fname, _= QFileDialog.getOpenFileName(parent=self, directory=folder, caption='Select a file')

    If I try to use `getOpenFileNames` instead of `getOpenFileName`, the interpreter crashes. Please advise.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,688
    Thanks
    13
    Thanked 1,598 Times in 1,526 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QFileDialog.getOpenFileNames crashes the interpreter

    Quote Originally Posted by pfeldman View Post
    If I try to use `getOpenFileNames` instead of `getOpenFileName`, the interpreter crashes. Please advise.
    How does it crash, because it certainly does not here.

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,776
    Thanks
    262
    Thanked 773 Times in 763 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QFileDialog.getOpenFileNames crashes the interpreter

    fname, _= QFileDialog.getOpenFileName(parent=self, directory=folder, caption='Select a file')
    Why the ",_" ? getOpenFileName() (or getOpenFileNames()) only returns a single value, either a QString or a QStringList.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QFileDialog::getopenFileNames - File select order
    By qtnewbie6019 in forum Qt Programming
    Replies: 1
    Last Post: 10th October 2015, 10:58
  2. QFileDialog crashes with MSVC 64bit
    By beneR-89 in forum Installation and Deployment
    Replies: 1
    Last Post: 3rd October 2015, 11:28
  3. Replies: 1
    Last Post: 30th October 2009, 04:42
  4. QFileDialog QGLWidget crashes
    By SenSej in forum Newbie
    Replies: 1
    Last Post: 17th October 2008, 18:06
  5. QFileDialog Crashes with Networked Drive
    By Rayven in forum Qt Programming
    Replies: 6
    Last Post: 20th February 2008, 03:01

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.