Comments (4)
As always debugging asyncio code is a bit of a PITA :-)
I can point you at a working example using Rubicon's CocoaLifecycle - toga. The cocoa and iOS backends both use Rubicon.
You may also have some luck looking at the unit tests for the asyncio code
As for debugging what is going on in this case - I tried copy/pasting that code to my own machine, and ran it (Mojave 10.14.2, Python 3.7), and it worked. It didn't do anything - but then, it's just starting an application, so there won't be anything visible happening. Can you share any more details about your testing environment?
from rubicon-objc.
Thank you for the links to working examples, and thank you for confirming that it works on your machine. I'm also running Mojave 10.14.2, Python 3.7, but I realized something else; I only get the error on subsequent program runs. I can run it, then exit (via Quit on the rocket ship icon), then run it again, and immediately get the error. If I wait some amount of time, a few minutes perhaps, it will run again without error. That seems undesirable, but it may be a result of how I'm killing the application...?
from rubicon-objc.
That behavior suggests the problem is a socket resource not being released.
You say you are getting the rocket ship icon and using Quit from the application menu - I take it this means you're using a python.org installer version of Python? In that case, it's possible that what you're quitting by using the menu is Python, not the NSApplication - and as a result, the network resources consumed by the event loop may not be released correctly. I'm not sure if that's a problem with Python or Rubicon, though...
For the record - I'm using a pyenv installed version, so I don't get the rocket ship. I'm staring the app from the command line, and terminating the program using CTRL-C. If you do the same, what behavior do you see?
from rubicon-objc.
I'm unsure how it was installed, as Python came pre-installed (I'm using MacInCloud). I am also starting the app from the command line, but this example program will not exit via CTRL-C. Oddly enough, I am able to exit other Python programs with CTRL-C.
As my error appears to be related to how I'm exiting Python, I'll go ahead and close this issue. Thanks again for your responses and the hint to read through the toga implementation!
from rubicon-objc.
Related Issues (20)
- Calling performSelector for a @objc_method created by rubicon from Objective C crashes in Python 3.9 HOT 3
- Blocks not fully working on M1 hardware HOT 5
- "ObjC Class 'b'WrappedPyObject'' couldn't be found." when running on iOS device HOT 7
- iOS event loop blocks when thread waits on socket.
- x86_64 machine architecture not identified correctly on iOS simulator
- Attribute intermittently returns the wrong object HOT 5
- Segmentation fault when exiting multi-threaded program
- Race condition when instantiating ObjCInstance objects
- Race condition when populating the ObjCClass method/attribute cache
- Update CI configuration to test release artefacts
- Improve correspondence between ObjectiveC objects and Python wrappers HOT 17
- New caching logic may inadvertently release objects that are still needed HOT 5
- ctypes.ArgumentError message is split into individual characters
- Warning about deprecated `pkg_resources` API
- Incompatibility with `from __future__ import annotations` HOT 1
- Incompatibility with Python 3.12.0b1 HOT 4
- Scroll blocks eventloop for ios HOT 3
- Can't invoke Protocol methods that collide with object properties HOT 2
- "ImportError: No module named 'rubicon'" if trying to bundle script via py2app. HOT 1
- Sphinx 7.2 dropped support for Python 3.8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rubicon-objc.