Skip to content

NotImplementedError: _dyld_shared_cache_contains_path not available #372

@takeru

Description

@takeru
  • bleak version: 0.9.1
  • Python version: 3.8.5
  • Operating System: macOS 10.15.6

Description

NotImplementedError: _dyld_shared_cache_contains_path not available

What I Did

search.py

import asyncio
from bleak import discover

async def run():
    devices = await discover()
    for d in devices:
        print(d)

loop = asyncio.get_event_loop()
loop.run_until_complete(run())

run

python search.py

output

% python search.py
Traceback (most recent call last):
  File "/Users/takeru/.pyenv/versions/3.8.5-SwitchBot/lib/python3.8/site-packages/bleak/__init__.py", line 55, in <module>
    from CoreBluetooth import CBPeripheral
  File "/Users/takeru/.pyenv/versions/3.8.5-SwitchBot/lib/python3.8/site-packages/CoreBluetooth/__init__.py", line 10, in <module>
    import Foundation
  File "/Users/takeru/.pyenv/versions/3.8.5-SwitchBot/lib/python3.8/site-packages/Foundation/__init__.py", line 9, in <module>
    import CoreFoundation
  File "/Users/takeru/.pyenv/versions/3.8.5-SwitchBot/lib/python3.8/site-packages/CoreFoundation/__init__.py", line 16, in <module>
    objc.pathForFramework("/System/Library/Frameworks/CoreFoundation.framework"),
  File "/Users/takeru/.pyenv/versions/3.8.5-SwitchBot/lib/python3.8/site-packages/objc/_dyld.py", line 148, in pathForFramework
    fpath, name, version = infoForFramework(dyld_find(path))
  File "/Users/takeru/.pyenv/versions/3.8.5-SwitchBot/lib/python3.8/site-packages/objc/_dyld.py", line 142, in dyld_find
    return dyld_framework(filename, framework_name, version)
  File "/Users/takeru/.pyenv/versions/3.8.5-SwitchBot/lib/python3.8/site-packages/objc/_dyld.py", line 101, in dyld_framework
    if _dyld_shared_cache_contains_path(f):
NotImplementedError: _dyld_shared_cache_contains_path not available

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "search.py", line 2, in <module>
    from bleak import discover
  File "/Users/takeru/.pyenv/versions/3.8.5-SwitchBot/lib/python3.8/site-packages/bleak/__init__.py", line 57, in <module>
    raise BleakError("Bleak requires the CoreBluetooth Framework") from ex
bleak.exc.BleakError: Bleak requires the CoreBluetooth Framework

Change _dyld.py and run.

lib/python3.8/site-packages/objc/_dyld.p

#try:
#    from objc._objc import _dyld_shared_cache_contains_path
#except ImportError:
#    _dyld_shared_cache_contains_path = None
_dyld_shared_cache_contains_path = None

I can see device list. Works well.

Is it issue of pyobjc-core? or pyobjc-**?

% pip list
Package                        Version
------------------------------ -------
bleak                          0.9.1
pip                            20.1.1
pyobjc-core                    7.0
pyobjc-framework-Cocoa         7.0
pyobjc-framework-CoreBluetooth 7.0
pyobjc-framework-libdispatch   7.0
setuptools                     47.1.0
% pip list
Package                        Version
------------------------------ -------
bleak                          0.9.1
pip                            20.1.1
pyobjc-core                    6.2.2
pyobjc-framework-Cocoa         6.2.2
pyobjc-framework-CoreBluetooth 6.2.2
pyobjc-framework-libdispatch   6.2.2
setuptools                     47.1.0

OK, works with this versions.

@ronaldoussoren

Metadata

Metadata

Assignees

Labels

Backend: Core BluetoothIssues and PRs relating to the Core Bluetooth backenddependenciesPull requests that update a dependency file

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions