Skip to content

NameError on Import #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bhclowers opened this issue Dec 7, 2021 · 2 comments · Fixed by #27
Closed

NameError on Import #26

bhclowers opened this issue Dec 7, 2021 · 2 comments · Fixed by #27

Comments

@bhclowers
Copy link

Using circuitpython 7.0 (https://circuitpython.org/board/seeeduino_wio_terminal/) on the Wio Terminal, I run into an error with the adafruit_rtttl.mpy downloaded from https://circuitpython.org/libraries specific for 7.0 .

The specific error is:

Traceback (most recent call last):
File "code.py", line 3, in
File "adafruit_rtttl.py", line 158, in
NameError: name 'Optional' is not defined

Any ideas on how to get things rolling?

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Dec 7, 2021

I think we cannot add typing hints for variables such as these lines:

octave: int = Optional[None],
duration: Optional[int] = None,
tempo: Optional[int] = None,

I think that is supported in CPython but maybe not in CircuitPython since we don't have the typing module.

I will test out this theory and make a PR to resolve it for this library if my hunch is correct.

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Dec 7, 2021

Ah I was a bit mistaken. These are not "regular" variables they are arguments in a function. My understanding is that CircuitPython should be ignoring them. Not sure why it's trying to actually use Optional but it does make sense that it would raise an exception if it is since there is no typing module. It should still be a relatively easy fix though I think. Doing a little more troubleshooting then I'll make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants