{"id":6097,"library":"pyobjc-framework-discrecording","title":"PyObjC DiscRecording Framework","description":"PyObjC-framework-DiscRecording provides Python wrappers for Apple's DiscRecording framework on macOS, enabling interaction with CD/DVD burning hardware and related functionalities. It is part of the larger PyObjC project, which provides access to macOS frameworks from Python. The library is actively maintained with frequent updates to align with new macOS SDK versions and Python releases, currently at version 12.1.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","cocoa","objective-c","disc recording","hardware","pyobjc","framework"],"install":[{"cmd":"pip install pyobjc-framework-discrecording","lang":"bash","label":"Install pyobjc-framework-discrecording"}],"dependencies":[{"reason":"This package provides the core bridge between Python and Objective-C, essential for all PyObjC framework wrappers.","package":"pyobjc-core"}],"imports":[{"note":"The framework itself is imported as a module.","symbol":"DiscRecording","correct":"import DiscRecording"},{"note":"Classes within the framework are directly exposed in the top-level framework module, not the PyPI package name.","wrong":"from pyobjc_framework_discrecording import DRDevice","symbol":"DRDevice","correct":"from DiscRecording import DRDevice"}],"quickstart":{"code":"import DiscRecording\nimport objc\n\ndef list_disc_devices():\n    devices = DiscRecording.DRDevice.allDevices()\n    if not devices:\n        print(\"No disc burning devices found.\")\n        return\n\n    print(\"Available Disc Devices:\")\n    for device in devices:\n        print(f\"  Name: {device.displayName()}\")\n        print(f\"  Vendor: {device.vendorName()}\")\n        print(f\"  Product: {device.productName()}\")\n        print(f\"  Bus: {device.busName()}\")\n        print(f\"  Write Capabilities: {device.writeCapabilities()['DRDeviceCanWriteDisc']}\")\n        print(f\"  Can Burn: {device.canBurn()}\")\n        print(\"  ---\")\n\nif __name__ == \"__main__\":\n    # Ensure the Objective-C runtime is initialized\n    # (often handled automatically in app contexts, but explicit for scripts)\n    list_disc_devices()","lang":"python","description":"This example demonstrates how to import the DiscRecording framework and list all detected disc burning devices on the system, printing their basic information. This uses the `DRDevice` class to query device properties."},"warnings":[{"fix":"Upgrade your Python interpreter to a supported version (e.g., Python 3.10+ for PyObjC 12.1) before upgrading PyObjC.","message":"PyObjC versions frequently drop support for older Python versions. PyObjC 12.0 dropped Python 3.9, and PyObjC 11.0 dropped Python 3.8. Ensure your Python environment meets the `requires_python` specification for your PyObjC version.","severity":"breaking","affected_versions":"11.0, 12.0+"},{"fix":"Review code that interacts with `init` family methods, especially if it relies on manual `retain`/`release` or assumes specific reference counts before and after `init` calls. Trust PyObjC's ARC modeling unless you have specific reasons otherwise.","message":"Starting with PyObjC 11.1, the core bridge's Automatic Reference Counting (ARC) behavior for initializer methods (those in the 'init' family) was updated to more closely align with `clang` documentation. This means `init` methods now correctly 'steal' a reference to `self` and return a new one. Code that manually manages reference counts around `init` calls might need adjustment.","severity":"breaking","affected_versions":"11.1+"},{"fix":"If you override `__new__` in a Python subclass, ensure `__init__` is correctly implemented. If you rely on PyObjC's default `__new__`, be aware that `__init__` will not be called, and perform initialization directly in `__new__` or another appropriate method.","message":"In PyObjC 10.3, there was a change affecting how `__init__` is called when a class implements its own `__new__`. While partially reverted in 10.3.1, code relying on the PyObjC-provided `__new__` (i.e., not overridden in Python) still cannot use `__init__`. If you implement `__new__` in your Python subclass of an Objective-C class, `__init__` will be called. Otherwise, it won't.","severity":"gotcha","affected_versions":"10.3 - 10.3.1"},{"fix":"If using Python 3.13, ensure it is not compiled with free-threading support enabled, or use a Python version for which free-threading is not a factor when working with PyObjC.","message":"PyObjC does not currently support Python's experimental free-threading (PEP 703), which was introduced in Python 3.13. Running PyObjC with a free-threading enabled Python 3.13 interpreter may lead to unexpected behavior or crashes.","severity":"gotcha","affected_versions":"10.3, 11.0+"},{"fix":"For non-filesystem-bound URLs, use Cocoa methods to extract string representations (e.g., `url.absoluteString()`) rather than relying on `os.fspath()` for path-like object conversion.","message":"As of PyObjC 10.1, `os.fspath()` will not work directly with Cocoa `NSURL` or `CFURLRef` objects that do not refer to local filesystem paths, raising a `TypeError`. It only works for URLs convertible to local paths.","severity":"gotcha","affected_versions":"10.1+"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}