plyer
plyer copied to clipboard
filechooser.save_file pyobjus-related (?) error on MacOS
Hey there! Getting a following error:
File "/Users/xxx/kivyapp/macosx/main.py", line 156, in download_report
filechooser.save_file(
File "/Users/xxx/mambaforge/envs/pyinstKivy/lib/python3.10/site-packages/plyer/facades/filechooser.py", line 61, in save_file
return self._file_selection_dialog(mode="save", *args, **kwargs)
File "/Users/xxx/mambaforge/envs/pyinstKivy/lib/python3.10/site-packages/plyer/platforms/macosx/filechooser.py", line 122, in _file_selection_dialog
return MacFileChooser(**kwargs).run()
File "/Users/xxx/mambaforge/envs/pyinstKivy/lib/python3.10/site-packages/plyer/platforms/macosx/filechooser.py", line 67, in run
panel = NSSavePanel.savePanel()
File "pyobjus/pyobjus.pyx", line 499, in pyobjus.ObjcMethod.__call__
File "pyobjus/pyobjus_conversions.pxi", line 240, in pyobjus.convert_cy_ret_to_py
File "pyobjus/pyobjus_conversions.pxi", line 181, in pyobjus.convert_to_cy_cls_instance
File "pyobjus/pyobjus.pyx", line 736, in pyobjus.autoclass
File "pyobjus/pyobjus.pyx", line 622, in pyobjus.resolve_super_class_methods
File "pyobjus/pyobjus.pyx", line 538, in pyobjus.class_get_methods
File "pyobjus/pyobjus.pyx", line 530, in pyobjus.objc_method_to_py
File "pyobjus/pyobjus.pyx", line 239, in pyobjus.ObjcMethod.__init__
File "pyobjus/type_enc.pxi", line 13, in pyobjus.parse_signature
File "pyobjus/type_enc.pxi", line 2, in pyobjus.seperate_encoding
IndexError: list index out of range
OS: MacOS Monterrey 12.6 (M1 Apple Silicon)
The most interesting part is that it sometimes works, and sometimes doesn't, and I couldn't figure out what is the reason behind this behaviour..
Code snippet just in case:
def download_report(self):
filechooser.save_file(
path=self.get_downloads_folder(),
filters=[("PDF files", "*.pdf")],
on_selection=self.save_report_selection,
preview=False,
)
I have solution this problem.In filechooser.py
does not use pyobjus
library. I think you need reinstall pyobjc
to newest version via command
pip install -U PyObjC
That is all.
@Alexandro1112 hey there! thanks for the reply. Unfortunately, I've tried it too and it doesn't help. :(