Blocks: "change <variable> by" block causes import error
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, python
- Domain
- embedded-iot, tooling
Research direction
Reproduce the linked example in the editor and inspect the generated Python for the import and change-variable expression. Trace the block's code-generation path; the issue is done when the example imports successfully on the device and the generated code no longer produces the reported confusing expression.
Written by the indexing model from the issue text.
Description
The 'change variable by' block causes the following import statement to be emitted:
from numbers import Number
Which in turn causes an ImportError on the device.
It also generates rather confusing code:
count = (count if isinstance(count, Number) else 0) + -1
See the following program as an example of failure:

- Dominant language
- JavaScript
- Stars
- 201
- Forks
- 126
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bbcmicrobit/PythonEditor
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
bbcmicrobit/PythonEditor#406 ·
-
U Open
Difficulty 5/5 Over a week Newbie friendliness 1/100
bbcmicrobit/PythonEditor#405 ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
bbcmicrobit/PythonEditor#391 · 2 comments · 6 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
bbcmicrobit/PythonEditor#375 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
bbcmicrobit/PythonEditor#367 ·
All issues in bbcmicrobit/PythonEditor
Similar issues
-
bug customer-eng Durable Agents Inngest status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/OrgExplorer#253 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100