Giter Club home page Giter Club logo

Comments (4)

freakboy3742 avatar freakboy3742 commented on June 11, 2024

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.

infinityis avatar infinityis commented on June 11, 2024

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.

freakboy3742 avatar freakboy3742 commented on June 11, 2024

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.

infinityis avatar infinityis commented on June 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.