I have the following simple schema:

@0x8fe87a03768154e9;

enum Side {
buy @0;
sell @1;
}

struct TradeMessage {
time @0 : Float64;
tradeId @1 : Int64;
side @2 : Side;
size @3 : Float64;
price @4 : Float64;
}

struct Level1BookUpdateMessage {
time @0 : Float64;
best_bid_qty @1 : Float64;
best_bid_px @2 : Float64;
best_ask_qty @3 : Float64;
best_ask_px @4 : Float64;
}

which I am loading as follows using pycapnp 1.0.0 on MacOS 11.4 running 
Python 3.8:

import capnp

from pathlib import Path

capnp_path = Path(__file__).parent / '../../../../capnp/serenity-fh.capnp'
capnp_def = capnp.load(capnp_path)

It fails on load with the following error. Any ideas on what I might be 
doing wrong?

Connected to pydev debugger (build 202.6397.98)
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
  File 
"/Users/kdowney/dev/shadows/serenity/src/serenity/marketdata/fh/txlog.py", 
line 6, in <module>
    capnp_def = capnp.load(capnp_path)
  File "capnp/lib/capnp.pyx", line 4030, in capnp.lib.capnp.load
  File "capnp/lib/capnp.pyx", line 3276, in 
capnp.lib.capnp.SchemaParser.load
AttributeError: 'PosixPath' object has no attribute 'endswith'

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/26dda48a-5ca0-4b0c-a42f-930d96b388a4n%40googlegroups.com.

Reply via email to