enthought / enthought/traitsui

Strange logs when using macOS file search with `FileEditor`

Open
#1,573 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

### Problem

The following lines are printed to the terminal four times when typing a character into the search box of the file dialog. Then they are printed once on each key stroke.

```
2021-04-06 17:08:23.077 Python[37482:558074] -[NSNull length]: unrecognized selector sent to instance 0x7fff8893e000
2021-04-06 17:08:23.077 Python[37482:558074] Exception calling directoryDidChange: on delegate exception=-[NSNull length]: unrecognized selector sent to instance 0x7fff8893e000
```

Note, that there's no crash and no other indication of error.

### To reproduce
- Run the following script

Script

```python
import sys

import PyQt5.QtCore

import traits
from traits.api import *
import traitsui
from traitsui.api import *

class Model(HasTraits):

filename = Str()

class ViewModel(ModelView):

model = Instance(Model)

def default_traits_view(self):
return View(
Item('model.filename', editor=FileEditor()),
)

if __name__ == '__main__':
print('TraitsUI', traitsui.__version__)
print('Traits', traits.__version__)
print('PyQt5', PyQt5.QtCore.QT_VERSION_STR)
print('Python', sys.version)
model = Model()
viewmodel = ViewModel(model=model)
viewmodel.configure_traits()
```

- Click on the little blue directory icon to the right of the text box
- Type "a" in the search box of the file dialog (see the top-right corner of the screenshot)
![Screenshot 2021-04-06 at 17 09 00](https://user-images.githubusercontent.com/63169891/113743125-3845fa80-96fb-11eb-87f8-e16395ef149e.png)

### System information
TraitsUI 7.1.1
Traits 6.2.0
PyQt5 5.12.6
Python 3.6.13
macOS 10.15.7

### Notes
A similar error is reported in some other issues, but those seem to be unrelated to `FileEditor`.
- enthought/traitsui#623
- enthought/mayavi#581

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.