bbcmicrobit / bbcmicrobit/PythonEditor

Blocks: "change <variable> by" block causes import error

Open
#45 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
201
Forks
126
PR merge metrics
No merged PRs in 30d

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:
![image](https://cloud.githubusercontent.com/assets/147113/24100039/2f15c360-0d6a-11e7-817b-1b5885706e2f.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.