isl-org / isl-org/Open3D

Filedialog set_on_done callback not working when using open3D with Pyinstaller, any ideas?

Open
#6,533 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `main` branch).

### Describe the issue

We have a functional GUI with some features and etc. The problem appears if we generate an executable using pyinstaller. I know this is open3D but maybe somebody could give a hint of what may be happening. Everything in the executable works perfectly except filedialogs. To reproduce the error, if at any moment the user clicks the button to open the filedialog, it will open the dialog, it may be canceled with no error, but right at the time of clicking open of a file, or doing doble-click on a file, the program crushes with no information, the file dialog does not close.

I have below two methods, very basic, we followed gallery examples:

After some debugging I have isolated the error to a wrong handling in the callback to _on_select_savedir_dialog_done and getting the filename variable, also as I mentioned before self.window.close_dialog() is not executed since the dialog never closes.

Does somebody have an idea of what may be happening? are there any open3d resources (binaries etc..) that are only used in the filedialogs that we may need to import manually in the spec file of pyinstaller? We added manually to the spec file all the open3d/resources

thanks in advance

### Steps to reproduce the bug

```python
...
def _on_select_savedir_clicked(self):
dlg = gui.FileDialog(gui.FileDialog.OPEN, "Open the destination folder", self.window.theme)

# A file dialog MUST define on_cancel and on_done functions
dlg.set_on_cancel(lambda: self.window.close_dialog())
dlg.set_on_done(self._on_select_savedir_dialog_done)
self.window.show_dialog(dlg)
print('___________', self._on_select_savedir_dialog_done)
logging.info('Puntero de _on_select_savedir_dialog_done {}'.format(self._on_select_savedir_dialog_done))

def _on_select_savedir_dialog_done(self, filename):
self.window.close_dialog()
self.dumpDirectory = P(filename).parent
notDdrive = self.callbacks['_on_select_savedir_dialog_done'](self.dumpDirectory)
if notDdrive:
self.show_message_dialog('Error in drive selection', 'Please, select a folder within D: drive')
...
```

### Error message

No error message

### Expected behavior

The filedialog would enable to select a file that will be saved in a variable, then the dialog will be closed.

### Open3D, Python and System information

```markdown
- Operating system: Windows 11 64-bit
- Python version: Python 3.8.17
- Open3D version: output from python: 0.17.0
- System architecture: x64
- Is this a remote workstation?: no
- How did you install Open3D?: pip
```

### Additional information

I cannot provide the full code, but if required I could provide a small demo of an executable with GUI and a filedialog

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.