kivy / kivy/pyobjus

autoclass('NSString', ... ) => 'TypeError: expected bytes, str found'

Open
#76 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
192
Forks
47
PR merge metrics
No merged PRs in 30d

Description

After converting the Print() statements in https://github.com/kivy/pyobjus/blob/master/examples/using_autoclass.py from Python2 to Python3 I deployed it on the iPhone 7 simulator in Xcode ver. 12.4 on MacOS Catalina ver. 10.15.7. The first few statements work fine, but line 17:
```
NSString = autoclass('NSString', load_class_methods=['alloc'], load_instance_methods=['init', 'initWithString:', 'UTF8String'])
```
results in this error:
```
Traceback (most recent call last):
File "/Users/henrik/pyobjus-original-example-ny-ios/YourApp/main.py", line 17, in
File "pyobjus/pyobjus.pyx", line 719, in pyobjus.pyobjus.autoclass
File "pyobjus/pyobjus.pyx", line 556, in pyobjus.pyobjus.class_get_partial_methods
TypeError: expected bytes, str found
2021-03-19 20:57:08.013155+0100 pyobjus-original-example-ny[12926:512737] Application quit abnormally!
2021-03-19 20:57:08.021033+0100 pyobjus-original-example-ny[12926:512737] Leaving
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with examples/using_autoclass.py at line 17, then trace the call through pyobjus.pyx, especially autoclass and class_get_partial_methods. Reproduce the Python 3 failure in the reported iPhone simulator setup and verify that loading NSString with the listed methods completes without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, python
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.