Describe the bug
If you give UIFileDialog the options "allow_picking_directories=True" and "initial_file_path=[valid_folder_path]" it causes this error:
File "C:...\env\lib\site-packages\pygame_gui\windows\ui_file_dialog.py", line 94, in init
if not self._validate_file_path(self.current_file_path):
File "C:...\env\lib\site-packages\pygame_gui\windows\ui_file_dialog.py", line 232, in _validate_file_path
return self._validate_path_in_existing_directory(path_to_validate)
File "C:...\env\lib\site-packages\pygame_gui\windows\ui_file_dialog.py", line 244, in _validate_path_in_existing_directory
return len(path_to_validate.name) > 0 and path_to_validate.parent.exists()
AttributeError: 'str' object has no attribute 'name'
I think this is due to a missing type cast in the ui_file_dialog.py line 69 where instead of :
self.current_file_path = self.current_directory_path
it should be:
self.current_file_path = Path(self.current_directory_path)
Tested this, reproduced the bug and implemented the fix suggested above in the 0.6.0 branch. Thanks very much for reporting it and doing the work to find the fix!
Describe the bug If you give UIFileDialog the options "allow_picking_directories=True" and "initial_file_path=[valid_folder_path]" it causes this error:
File "C:...\env\lib\site-packages\pygame_gui\windows\ui_file_dialog.py", line 94, in init if not self._validate_file_path(self.current_file_path): File "C:...\env\lib\site-packages\pygame_gui\windows\ui_file_dialog.py", line 232, in _validate_file_path return self._validate_path_in_existing_directory(path_to_validate) File "C:...\env\lib\site-packages\pygame_gui\windows\ui_file_dialog.py", line 244, in _validate_path_in_existing_directory return len(path_to_validate.name) > 0 and path_to_validate.parent.exists() AttributeError: 'str' object has no attribute 'name'
I think this is due to a missing type cast in the ui_file_dialog.py line 69 where instead of :
self.current_file_path = self.current_directory_path
it should be:self.current_file_path = Path(self.current_directory_path)
Platform and software :