HMaker / python-cdp

Python client and types generator for the Chrome DevTools Protocol (CDP)
MIT License
51 stars 17 forks source link

cdpgen not generating util.py file #5

Closed TurboKach closed 1 year ago

TurboKach commented 1 year ago

after executing a cdpgen --browser-protocol devtools-protocol/browser_protocol.json --js-protocol devtools-protocol/js_protocol.json --output cdp/ command, script does not create a util.py which used in cdp/accessibility.py.

Used environment: MacOS Poetry

Here is my traceback:

Traceback (most recent call last):
  File "/Users/turbokach/Dev/betbot_cdp/script.py", line 2, in <module>
    import cdp
  File "/Users/turbokach/Dev/betbot_cdp/cdp/__init__.py", line 6, in <module>
    from . import (accessibility, animation, audits, background_service, browser, css, cache_storage, cast, console, dom, dom_debugger, dom_snapshot, dom_storage, database, debugger, device_orientation, emulation, event_breakpoints, fetch, headless_experimental, heap_profiler, io, indexed_db, input_, inspector, layer_tree, log, media, memory, network, overlay, page, performance, performance_timeline, profiler, runtime, schema, security, service_worker, storage, system_info, target, tethering, tracing, web_audio, web_authn)
  File "/Users/turbokach/Dev/betbot_cdp/cdp/accessibility.py", line 12, in <module>
    from .util import event_class, T_JSON_DICT
ModuleNotFoundError: No module named 'cdp.util'
HMaker commented 1 year ago

Yes, we need to copy the util.py file in the actual cdp package at https://github.com/HMaker/python-cdp/blob/e902d8bae3284bd4a08d46f0e34de2ac8c4e0e05/pycdp/gen/generate.py#L1077-L1079