baking-bad / pytezos

🐍 Python SDK for Tezos | Michelson VM in Python
https://pytezos.org
MIT License
112 stars 38 forks source link

Ithaca: missing key 'time_between_blocks' in self.constants #291

Closed ztepler closed 2 years ago

ztepler commented 2 years ago

When using ithacanet shell, pytezos.now() and pytezos.wait(opg) calls fail with the following traceback:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Input In [36], in <module>
----> 1 pytezos.now()

File ~/env/lib/python3.10/site-packages/pytezos/jupyter.py:89, in inline_doc.<locals>.CustomReprDescriptor.__get__.<locals>.MethodWrapper.__call__(self, *args, **kwargs)
     87     return method(*args, **kwargs)
     88 else:
---> 89     return method(self.obj, *args, **kwargs)

File ~/env/lib/python3.10/site-packages/pytezos/client.py:109, in PyTezosClient.now(self)
    107 def now(self) -> int:
    108     """Timestamp of the latest block + block time (UTC)."""
--> 109     return self.context.get_now()

File ~/env/lib/python3.10/site-packages/pytezos/context/impl.py:336, in ExecutionContext.get_now(self)
    334     ts = self.shell.head.header()['timestamp']
    335     dt = datetime.strptime(ts, '%Y-%m-%dT%H:%M:%SZ')
--> 336     first_delay = self.constants['time_between_blocks'][0]
    337     return int((dt - datetime(1970, 1, 1)).total_seconds()) + int(first_delay)
    338 else:

KeyError: 'time_between_blocks'

I am using Python 3.10 with PyTezos 3.4.1