Python crashed by CGEventCreateKeyboardEvent() from Core Graphics

Issue #238 wontfix
created an issue

I have a crash after call CGEventCreateKeyboardEvent() - "Python quit unexpectedly while using the plug-in" Mac os High Sierra 10.13 Python 2.7.10 pyobjc (4.1) pyobjc-core (4.1)

Thanks and Regards Artem

Comments (14)

  1. Zemtsov-artem reporter

    @Ronald Oussoren yes , i have .

    import macos_functions
    import time
    import AppKit
    from Quartz import (
    from Foundation import *
    from CoreFoundation import *
    from ApplicationServices import *
    # crashed after CGEventCreateKeyboardEvent
    keyDown = CGEventCreateKeyboardEvent(objc.NULL,11,True)
    # does not printed
    keyUp = CGEventCreateKeyboardEvent(objc.NULL,11,False)
    # does not printed
  2. Ronald Oussoren repo owner

    That's annoying, the script doesn't crash for me. I did have to remove the import of macos_functions, but otherwise the script worked fine.

    I did use python 3.6.3 though, and haven't tested with 2.7 yet.

  3. Ronald Oussoren repo owner

    It works with python 2.7.14 as well.

    I did test with the head of the repository, but AFAIK there are no changes that could explain the difference.

    How did you install python? Do you use a virtualenv?

  4. Zemtsov-artem reporter

    @Ronald Oussoren i'm sorry for " import of macos_functions" in my example. Python was integrated in os . Which version of mac os are you using? If it is 10.13 i'll try to reinstall python and all packages, because the check on 10.2.5 was successful.

  5. Ronald Oussoren repo owner

    I'm on 10.13.3, but didn't use /usr/bin/python. I generally don't use /usr/bin/python because I don't want to mess with the site-packages directory of that install and prefer to use an up-to-date version of Python.

    Anyways... I'm currently building a virtualenv using /usr/bin/python

  6. Ronald Oussoren repo owner

    It works for me with /usr/bin/python as well.

    How I tested: Create virtualenv (using "/usr/bin/python -mvirtualenv workenv27") Activate the virtualenv * Install pyobjc in the virtualenv from source

    Next thing to test: using binary packages from PyPI

  7. Vasily Ryabov

    Hi @Ronald Oussoren I saw this problem with these versions: macOS 10.13.1, Python 2.7.10

    2.7.10 is not so old. So some users may face the same issue. But it might be a Python bug, of course. Just curious if it is or it could be fixed on pyobjc side.

  8. Ronald Oussoren repo owner

    I haven't tried to reproduce yet.

    I'm currently primarily focused on getting PyObjC ready for macOS 10.14, and will try to find a solution during that work. If that leads to a fix that can easily be back ported to the current release I'll do so.

  9. Ronald Oussoren repo owner

    I cannot reproduce this event with /usr/bin/python or python3.7 on 10.13.6 and 10.14.2. Both using PyObjC 5.1.2 (the current tip of the repository, but the same should be true of the current release as all changes since 5.1.1 have been small bug fixes that don't affect this code).

    I'm going to close this issue because I cannot reproduce.

  10. Log in to comment