plyer icon indicating copy to clipboard operation
plyer copied to clipboard

Filechooser doesn't work on Mac

Open GrumpyPanda98 opened this issue 2 years ago • 7 comments

When trying to use plyers filechooser:

import plyer as pl
path=pl.filechooser.open_file()
I get the following error:
  File "/Users/user/Documents/GitHub/PigBrain/loader.py", line 24, in load_mat_file
    path=pl.filechooser.open_file()

  File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/plyer/facades/filechooser.py", line 50, in open_file
    return self._file_selection_dialog(mode="open", *args, **kwargs)

  File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/plyer/facades/filechooser.py", line 70, in _file_selection_dialog
    raise NotImplementedError()

NotImplementedError

Using macosx Python 3.8.8

GrumpyPanda98 avatar Mar 17 '22 10:03 GrumpyPanda98

I can confirm. Tried this on macosx, python 3.10, and got the same error.

el3 avatar Mar 17 '22 10:03 el3

Works fine on mine. No errors. Macosx, python 3.9.9.

CMengich avatar Apr 03 '22 15:04 CMengich

When trying to use plyers filechooser:

import plyer as pl
path=pl.filechooser.open_file()
I get the following error:
  File "/Users/user/Documents/GitHub/PigBrain/loader.py", line 24, in load_mat_file
    path=pl.filechooser.open_file()

  File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/plyer/facades/filechooser.py", line 50, in open_file
    return self._file_selection_dialog(mode="open", *args, **kwargs)

  File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/plyer/facades/filechooser.py", line 70, in _file_selection_dialog
    raise NotImplementedError()

NotImplementedError

Using macosx Python 3.8.8

I get the exact same error on macOS

NicFolk avatar Apr 09 '22 18:04 NicFolk

Even I get the same issue on Mac

Wild-in-Programming avatar Apr 18 '22 06:04 Wild-in-Programming

I can confirm, I've got the same issue on macOS / Python 3.10.3

Grubersky avatar Apr 20 '22 15:04 Grubersky

I fixed this error, we need to pip install pyobjus.

flueky avatar Jun 23 '22 14:06 flueky

Afaik, someone is working with including pyobjus on mac instalations

NomadDemon avatar Jun 23 '22 15:06 NomadDemon

Same error (Mac M1, Python 3.10, kivy 2.1, kivymd 1.1.1) occurs even with installed pyobjus, but only after packaging with pyinstaller. App just crashes :(

yas0nia avatar Apr 23 '23 17:04 yas0nia

+1 on having this error only after pyinstaller

Fretless14 avatar Jun 10 '23 15:06 Fretless14

flueky

This worked for me. Using pyenv 3.11.2

NathanKoehler avatar Sep 25 '23 21:09 NathanKoehler

My reading of the above is that this has been solved by installing the necessary packages.

I am going to close as completed, but if you have installed pyobjus and it still doesn't work, let us know.

Julian-O avatar Oct 27 '23 00:10 Julian-O

If this is only happening after creating a pyinstaller build, make sure you have added a hidden import like this --hidden-import plyer.platforms.macosx.filechooser other than that, for me this happens when I import AppKit in my code or use some other library that uses AppKit.

ibtsam3301 avatar Oct 30 '23 18:10 ibtsam3301