-
Notifications
You must be signed in to change notification settings - Fork 32
Description
I was testing the CLI flow (concore init → concore run) and noticed the sample script.py that gets generated doesn't actually work. It crashes right away with an AttributeError.
What happens thatt
Running concore init my-project creates src/script.py with this:
import concore
while not concore.concore_unchanged():
data = concore.concore_read()
result = data * 2
concore.concore_write(result)
But concore.py doesn't have concore_unchanged(), concore_read(), or concore_write(). Those names look like the MATLAB convention (concore_unchanged.m, concore_read.m) — in Python the functions are just unchanged(), read(), and write().
So the script immediately throws:
AttributeError: module 'concore' has no attribute 'concore_unchanged'
What it should look like
Looking at the actual demos (e.g., controller.py, controller.py), the real calling pattern is:
import concore
concore.default_maxtime(100)
concore.delay = 0.02
init_simtime_val = "[0.0, 0.0]"
val = concore.initval(init_simtime_val)
while concore.simtime < concore.maxtime:
while concore.unchanged():
val = concore.read(1, "data", init_simtime_val)
result = [v * 2 for v in val]
concore.write(1, "result", result, delta=0)
The current sample is also missing default_maxtime(), initval(), and has the loop structure inverted.
Where the bug is
init.py, lines 33-39 — the SAMPLE_PYTHON string.
This basically breaks the getting-started flow for anyone using the CLI for the first time. Happy to put up a fix if that works.