Directory cannot be chosen with DirectoryOnly file mode in QFileDialog
leungchikiissac opened this issue · 1 comments
Only Directory which has name with dot (".") can be chosen.
qfiledialog.py
if __name__ == '__main__':
from PyQt5.QtWidgets import QFileDialog, QApplication
import sys
app = QApplication(sys.argv)
file_dialog = QFileDialog(None, "Select Directory Data", "", 'All Files(*.*)')
file_dialog.setFileMode(QFileDialog.DirectoryOnly)
dir_name = ""
if file_dialog.exec_():
dir_name = file_dialog.selectedFiles()[0]
sys.exit(app.exec_())
System and software versions:
- Ubuntu 18.04.3 LTS
- Python 3.6.8
- PyQt5 5.13.1
I run the qfiledialog.py in virtual environment with only PyQt5 installed manually. The file dialog pops up and the appearance is as the following. But as you see only the directory "with_dot." is in black color and can be chosen. But directory "test_directory" does not.
I tried to run it with superuser command (sudo). All directory works fine right now. But I guess it is not expected to be only worked with root privilege. I also check the file permissions. I suspect nothing related to the directory's file permissions since directory "with_dot." and "test_directory" have identical status of the permission.