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

Move from Python 2.7 to Python 3. #2

Open
elenzil opened this issue Jul 25, 2018 · 5 comments
Open

Move from Python 2.7 to Python 3. #2

elenzil opened this issue Jul 25, 2018 · 5 comments

Comments

@elenzil
Copy link
Contributor

elenzil commented Jul 25, 2018

There's a couple motivations for this, from most significant to least, imo:

  • python 3 offers more modern concurrency models,
    which would allow us to move away from the Threads currently in use in the examples.
  • python 3 has broader current adoption and is more standard currently.

I attempted this, but my python-foo ran out in getting the AdaFruit library to work with Python 3.
However it seems like that should not be an exotic use-case, so perhaps there's something obvious i'm missing.

@hawflakes
Copy link
Contributor

I have gotten some partial success by patching the Adafruit library. I'm going to work on it a bit more and then prepare a PR.

python 01_hello_world.py 
Disconnecting any connected robots..
Searching for robot types: (all) with names: (any).
matching robots: 1  non-matching robots: 0 ......        
Connecting to WW_ROBOT_DASH "Po"
Connected to 'Po'!
Starting a thread for Po.
> /Users/jack/play/py3/WonderPyExamples/tutorial/01_hello_world.py(31)thread_hello()
-> sound_names = self.get_hello_sounds(robot)
(Pdb) 2018-08-01 02:57:40.976 python[19009:2134353] *** Terminating app due to uncaught exception 'OC_PythonException', reason: '<class 'TypeError'>: ord() expected string of length 1, but int found'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff4fb722db __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fff76d22c76 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff4fb72229 -[NSException raise] + 9
	3   _objc.cpython-36m-darwin.so         0x0000000107f971ce PyObjCErr_ToObjCWithGILState + 46
	4   _objc.cpython-36m-darwin.so         0x0000000107fd4604 -[OC_PythonObject forwardInvocation:] + 820
	5   CoreFoundation                      0x00007fff4fae855c ___forwarding___ + 748
	6   CoreFoundation                      0x00007fff4fae81e8 _CF_forwarding_prep_0 + 120
	7   CoreBluetooth                       0x00007fff4f611e91 -[CBPeripheral handleAttributeEvent:args:attributeSelector:delegateSelector:delegateFlag:] + 241
	8   CoreBluetooth                       0x00007fff4f611fcd -[CBPeripheral handleCharacteristicEvent:characteristicSelector:delegateSelector:delegateFlag:] + 115
	9   CoreBluetooth                       0x00007fff4f60da1f -[CBPeripheral handleMsg:args:] + 297
	10  CoreBluetooth                       0x00007fff4f6084cb -[CBCentralManager handleMsg:args:] + 198
	11  CoreBluetooth                       0x00007fff4f6168ae __30-[CBXpcConnection _handleMsg:]_block_invoke + 53
	12  libdispatch.dylib                   0x00007fff7790a5fa _dispatch_call_block_and_release + 12
	13  libdispatch.dylib                   0x00007fff77902db8 _dispatch_client_callout + 8
	14  libdispatch.dylib                   0x00007fff77917217 _dispatch_queue_serial_drain + 635
	15  libdispatch.dylib                   0x00007fff7790a166 _dispatch_queue_invoke + 373
	16  libdispatch.dylib                   0x00007fff7790e221 _dispatch_main_queue_callback_4CF + 776
	17  CoreFoundation                      0x00007fff4fb2ac19 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	18  CoreFoundation                      0x00007fff4faecdfa __CFRunLoopRun + 2586
	19  CoreFoundation                      0x00007fff4faec153 CFRunLoopRunSpecific + 483
	20  Foundation                          0x00007fff51be8f26 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 277
	21  _objc.cpython-36m-darwin.so         0x0000000107fd78c7 ffi_call_unix64 + 79
	22  ???                                 0x00007ffee8dddee0 0x0 + 140732805275360
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

@hawflakes
Copy link
Contributor

The solution to the first hurdle is found here: https://github.com/adafruit/Adafruit_Python_BluefruitLE/pull/31/files

@hawflakes
Copy link
Contributor

Here's the PR #9

elenzil added a commit to hawflakes/WonderPy that referenced this issue Aug 1, 2018
@m42e
Copy link

m42e commented Dec 25, 2019

As life of python 2.7 is nearly at an end. What is the current status of migrating to py3?

@duckida
Copy link

duckida commented Jul 31, 2020

As life of python 2.7 is nearly at an end. What is the current status of migrating to py3?

What is migration status?

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

4 participants