playi / WonderPy

Official Public Python API for working with Wonder Workshop robots
MIT License
55 stars 28 forks source link

Uncaught exception OC_PythonException #32

Open ctpelok77 opened 2 years ago

ctpelok77 commented 2 years ago

When running the example on Mac 11.6.1 with python 3.8.2, the following exception occurs the moment Dash is switched on.

$ python 01_hello_world.py Disconnecting any connected robots.. Searching for robot types: (all) with names: (any). matching robots: 0 non-matching robots: 0 .......... 2022-02-26 15:50:21.182 python[60257:22632289] Terminating app due to uncaught exception 'OC_PythonException', reason: '<class 'AssertionError'>: <memory at 0x10f2d9400>' First throw call stack: ( 0 CoreFoundation 0x00007fff205d71db exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff20310d92 objc_exception_throw + 48 2 _objc.cpython-38-darwin.so 0x0000000104ce8a60 PyObjC_FreeCArray + 0 3 _objc.cpython-38-darwin.so 0x0000000104ce233d -[OC_PythonObject forwardInvocation:] + 733 4 CoreFoundation 0x00007fff2053efd6 __forwarding + 819 5 CoreFoundation 0x00007fff2053ec18 _CF_forwarding_prep_0 + 120 6 CoreBluetooth 0x00007fff309e5271 -[CBCentralManager handlePeripheralDiscovered:] + 1703 7 CoreBluetooth 0x00007fff309e7048 -[CBCentralManager handleMsg:args:] + 811 8 CoreBluetooth 0x00007fff309d9037 -[CBManager xpcConnectionDidReceiveMsg:args:] + 177 9 CoreBluetooth 0x00007fff309d8f73 __30-[CBXpcConnection _handleMsg:]_block_invoke + 66 10 libdispatch.dylib 0x00007fff202ba623 _dispatch_call_block_and_release + 12 11 libdispatch.dylib 0x00007fff202bb806 _dispatch_client_callout + 8 12 libdispatch.dylib 0x00007fff202c15ea _dispatch_lane_serial_drain + 606 13 libdispatch.dylib 0x00007fff202c20e0 _dispatch_lane_invoke + 417 14 libdispatch.dylib 0x00007fff202c7a08 _dispatch_main_queue_callback_4CF + 613 15 CoreFoundation 0x00007fff20599f18 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 16 CoreFoundation 0x00007fff2055c112 __CFRunLoopRun + 2755 17 CoreFoundation 0x00007fff2055af8c CFRunLoopRunSpecific + 563 18 Foundation 0x00007fff212ec607 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 19 libffi.dylib 0x00007fff2da458f5 ffi_call_unix64 + 85 20 ??? 0x000000011060b750 0x0 + 4569741136 ) libc++abi: terminating with uncaught exception of type NSException Abort trap: 6

jakesimonds commented 8 months ago

Getting possibly identical error with python3.8.8 & running OS 13.4, did you bold those two lines ('forwarding' & 'CFRUNLOOP...') yourself? Also I'm generating this error kind of every time I run 01_hello_world.py, whether the Dash is on, off, or if I have bluetooth turned on or off (on my mac, having just toggled it to test).

First time I ran the script it asked for permission for Terminal to use Bluetooth, no other permission clues.

This is getting into stuff I have no experience in, but seems like a WonderPy-talking-to-Mac-OS-Bluetooth stack issue? Would be interested if anybody knows of any other workarounds/alternate bindings!

% python3 01_hello_world.py
Disconnecting any connected robots.. Searching for robot types: (all) with names: (any). matching robots: 0 non-matching robots: 0 .......... 2024-02-10 08:23:43.352 python3[45294:2267349] Terminating app due to uncaught exception 'OC_PythonException', reason: '<class 'AssertionError'>: <memory at 0x7fd3b81d7a00>' First throw call stack: ( 0 CoreFoundation 0x00007ff806f0318a exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff806a2942b objc_exception_throw + 48 2 _objc.cpython-38-darwin.so 0x000000010344c125 PyObjCErr_ToObjCWithGILState + 1237 3 _objc.cpython-38-darwin.so 0x00000001034bc585 -[OC_PythonObject forwardInvocation:] + 757 4 CoreFoundation 0x00007ff806e6e51b __forwarding + 756 5 CoreFoundation 0x00007ff806e6e198 _CF_forwarding_prep_0 + 120 6 CoreBluetooth 0x00007ff81af11d48 -[CBCentralManager handlePeripheralDiscovered:] + 1736 7 CoreBluetooth 0x00007ff81af146b1 -[CBCentralManager handleMsg:args:] + 897 8 CoreBluetooth 0x00007ff81af00d41 -[CBManager xpcConnectionDidReceiveMsg:args:] + 177 9 CoreBluetooth 0x00007ff81af00c52 __30-[CBXpcConnection _handleMsg:]_block_invoke + 66 10 libdispatch.dylib 0x00007ff806c0dd91 _dispatch_call_block_and_release + 12 11 libdispatch.dylib 0x00007ff806c0f033 _dispatch_client_callout + 8 12 libdispatch.dylib 0x00007ff806c15200 _dispatch_lane_serial_drain + 769 13 libdispatch.dylib 0x00007ff806c15d6c _dispatch_lane_invoke + 417 14 libdispatch.dylib 0x00007ff806c1bf04 _dispatch_main_queue_drain + 751 15 libdispatch.dylib 0x00007ff806c1bc07 _dispatch_main_queue_callback_4CF + 31 16 CoreFoundation 0x00007ff806ecb205 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 17 CoreFoundation 0x00007ff806e8af2f __CFRunLoopRun + 2452 18 CoreFoundation 0x00007ff806e89f31 CFRunLoopRunSpecific + 560 19 Foundation 0x00007ff807d162c3 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 216 20 libffi.dylib 0x00007ff8174748c2 ffi_call_unix64 + 82 21 ??? 0x00007fd3b957b370 0x0 + 140547324359536 ) libc++abi: terminating due to uncaught exception of type NSException zsh: abort python3 01_hello_world.py

jakesimonds commented 8 months ago

Got past the above error message from following this discussion: https://github.com/playi/WonderPy/issues/2

BUT! Just hit more weird errors. Nothing insurmountable, but was over my head in the details.

Then found this, https://github.com/IlyaSukhanov/morseapi. Is working for me on ubuntu with a python2.7 venv , pretty much just following instructions in readme.

mewmix commented 7 months ago

If you guys want to try my fork of a fork from morse ~

https://github.com/mewmix/bleak-dash

Still a work in progress getting everything converted to async, but atleast you can use python 3

jakesimonds commented 7 months ago

Will check it out!

jakesimonds commented 7 months ago

Was able to connect my apple-chip and intel-chip macs! Great instructions, was super easy on both machines

mewmix commented 7 months ago

Great news. Thank you for testing. I am working on porting over the sensors now so we can hook into different states like "Dash is on his side" or "Dash picked up" , or the holy grail, "is something infront of dash?" :)