pyobjus icon indicating copy to clipboard operation
pyobjus copied to clipboard

IndexError in type_enc.pxi

Open cbenhagen opened this issue 9 years ago • 6 comments
trafficstars

On OS X Yosemite using a PyInstaller packaged app looking like this:

#!/usr/bin/env python
from plyer import filechooser

print(filechooser.choose_dir())

I get:

Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/usr/local/lib/python2.7/site-packages/plyer/facades/filechooser.py", line 53, in choose_dir
  File "/usr/local/lib/python2.7/site-packages/plyer/platforms/macosx/filechooser.py", line 104, in _file_selection_dialog
  File "/usr/local/lib/python2.7/site-packages/plyer/platforms/macosx/filechooser.py", line 48, in run
  File "pyobjus.pyx", line 439, in pyobjus.ObjcMethod.__call__ (pyobjus/pyobjus.c:31580)
  File "pyobjus_conversions.pxi", line 239, in pyobjus.convert_cy_ret_to_py (pyobjus/pyobjus.c:20238)
  File "pyobjus_conversions.pxi", line 180, in pyobjus.convert_to_cy_cls_instance (pyobjus/pyobjus.c:19322)
  File "pyobjus.pyx", line 669, in pyobjus.autoclass (pyobjus/pyobjus.c:34152)
  File "pyobjus.pyx", line 482, in pyobjus.class_get_methods (pyobjus/pyobjus.c:32077)
  File "pyobjus.pyx", line 474, in pyobjus.objc_method_to_py (pyobjus/pyobjus.c:31931)
  File "pyobjus.pyx", line 181, in pyobjus.ObjcMethod.__init__ (pyobjus/pyobjus.c:28225)
  File "type_enc.pxi", line 15, in pyobjus.parse_signature (pyobjus/pyobjus.c:4228)
  File "type_enc.pxi", line 4, in pyobjus.seperate_encoding (pyobjus/pyobjus.c:3999)
IndexError: list index out of range

Did I maybe miss to package a library?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/28985982-indexerror-in-type_enc-pxi?utm_campaign=plugin&utm_content=tracker%2F77137&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F77137&utm_medium=issues&utm_source=github).

cbenhagen avatar Dec 09 '15 16:12 cbenhagen

This is the package: https://www.dropbox.com/s/eb4a6pygjkrv67d/fc.zip?dl=1

cbenhagen avatar Dec 09 '15 16:12 cbenhagen

I just ran in to the same issue when using pyobjus together with rumps (no PyInstaller involved):

import rumps
from pyobjus import autoclass

NSString = autoclass('NSString')
text = NSString.alloc().initWithUTF8String_('Hello world')
print text.UTF8String()
  File "./issue-21.py", line 6, in <module>
    text = NSString.alloc().initWithUTF8String_('Hello world')
  File "pyobjus/pyobjus.pyx", line 439, in pyobjus.ObjcMethod.__call__ (pyobjus/pyobjus.c:33943)
  File "pyobjus/pyobjus_conversions.pxi", line 239, in pyobjus.convert_cy_ret_to_py (pyobjus/pyobjus.c:21592)
  File "pyobjus/pyobjus_conversions.pxi", line 180, in pyobjus.convert_to_cy_cls_instance (pyobjus/pyobjus.c:20519)
  File "pyobjus/pyobjus.pyx", line 670, in pyobjus.autoclass (pyobjus/pyobjus.c:36636)
  File "pyobjus/pyobjus.pyx", line 566, in pyobjus.resolve_super_class_methods (pyobjus/pyobjus.c:35260)
  File "pyobjus/pyobjus.pyx", line 482, in pyobjus.class_get_methods (pyobjus/pyobjus.c:34441)
  File "pyobjus/pyobjus.pyx", line 474, in pyobjus.objc_method_to_py (pyobjus/pyobjus.c:34298)
  File "pyobjus/pyobjus.pyx", line 181, in pyobjus.ObjcMethod.__init__ (pyobjus/pyobjus.c:30407)
  File "pyobjus/type_enc.pxi", line 15, in pyobjus.parse_signature (pyobjus/pyobjus.c:4441)
  File "pyobjus/type_enc.pxi", line 4, in pyobjus.seperate_encoding (pyobjus/pyobjus.c:4210)
IndexError: list index out of range

cbenhagen avatar Sep 04 '16 14:09 cbenhagen

I don't see this on current pyobjus, so it may have been fixed since then. Could you perhaps try with a recent pyobjus and let me know if we can close this?

hackalog avatar Feb 07 '19 15:02 hackalog

Closing as presumed fix. Did not hear back from OP.

Julian-O avatar Dec 11 '23 13:12 Julian-O

Hello @Julian-O! I wanted to let you know that it appears that this is now an issue again on macOS Sequoia (15.0) on my M3 pro Macbook Pro. I found this GitHub issue subsequently to doing a similar thing as OP. I can reproduce the error with the above code (using the latest version of plyer, and pyobjus):

...truncated...
   File "/Users/kaleb/Documents/GitHub/auto-mcs/build-tools/venv/lib/python3.9/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

macarooni-man avatar Sep 18 '24 19:09 macarooni-man

@macarooni-man Ditto, https://github.com/kivy/pyobjus/pull/89 seems to be already in place which fixes this issue.

Update: tested this pull makes it work on 15.0 and before.

akshayaurora avatar Sep 24 '24 07:09 akshayaurora