Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes on FileChooser with pyobjus/type_enc.pxi IndexError: list index out of range #43

Open
platipodium opened this issue Nov 6, 2024 · 3 comments

Comments

@platipodium
Copy link

Related to #21 and openjournals/joss-reviews#7185

On Mac M1 in conda/py-312/nccut46 environment hitting the FileChooser Dialog "Browse" results in an app crash.

Here's the log

   File "/opt/conda/envs/nccut/lib/python3.12/site-packages/kivy/lang/builder.py", line 60, in custom_callback
     exec(__kvlang__.co_value, idmap)
   File "/opt/conda/envs/nccut/lib/python3.12/site-packages/nccut/nccut.kv", line 418, in <module>
     on_press: root.browse()
 ^
   File "/opt/conda/envs/nccut/lib/python3.12/site-packages/nccut/homescreen.py", line 184, in browse
     files = filechooser.open_file(filters=[["Valid Files", "*.png", "*.jpg", "*.jpeg", "*.nc"]])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/conda/envs/nccut/lib/python3.12/site-packages/plyer/facades/filechooser.py", line 54, in open_file
     return self._file_selection_dialog(mode="open", *args, **kwargs)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/conda/envs/nccut/lib/python3.12/site-packages/plyer/platforms/macosx/filechooser.py", line 122, in _file_selection_dialog
     return MacFileChooser(**kwargs).run()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/opt/conda/envs/nccut/lib/python3.12/site-packages/plyer/platforms/macosx/filechooser.py", line 59, in run
     panel = NSOpenPanel.openPanel()
             ^^^^^^^^^^^^^^^^^^^^^^^
   File "pyobjus/pyobjus.pyx", line 504, 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 741, in pyobjus.autoclass
   File "pyobjus/pyobjus.pyx", line 627, in pyobjus.resolve_super_class_methods
   File "pyobjus/pyobjus.pyx", line 543, in pyobjus.class_get_methods
   File "pyobjus/pyobjus.pyx", line 535, in pyobjus.objc_method_to_py
   File "pyobjus/pyobjus.pyx", line 244, 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

@rchartra
Copy link
Owner

I've looked into this issue and it seems to be a bug with the file selection widget from Kivy on MacOS (see here). It seems it's been fixed but not released and I don't think they are planning on doing a release any time soon unfortunately. The FileChooser works fine on the Macs I have access to so I'm hoping I can figure out what the difference is. Otherwise there's other python UI frameworks that provide file selection functionality but I was running into issues with those before as mixing frameworks is generally not well supported.

For now I will add an error popup so at least the app won't crash and the user can still type in the file path manually.

@platipodium
Copy link
Author

I am happy with a temporary fix; that way, I can continue testing your software. For now, this is a showstopper also for my review, I'm afraid.

@rchartra
Copy link
Owner

Sounds good, I'll let you know when it's in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants