Skip to content
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

Lego MicroPython Failed to Run #1898

Closed
stan-ct opened this issue Dec 1, 2021 · 4 comments
Closed

Lego MicroPython Failed to Run #1898

stan-ct opened this issue Dec 1, 2021 · 4 comments

Comments

@stan-ct
Copy link

stan-ct commented Dec 1, 2021

What were you trying to do?

Wrote MicroPython on Lego SPIKE

What steps did you take to trigger the issue?

Here is the code I wrote:

from spike import PrimeHub
hub = PrimeHub()
hub.left_button.wait_until_pressed()

What did you expect to happen?

No response

What actually happened?

HUB: sync filesystems
HUB: soft reboot
raw REPL; CTRL-B to exit
>OK

�Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "spike/__init__.py", line 1, in <module>
  File "_api/__init__.py", line 1, in <module>
  File "_api/speaker.py", line 1, in <module>
  File "system/__init__.py", line 1, in <module>
  File "system/callbacks/__init__.py", line 1, in <module>
  File "util/error_handler.py", line 1, in <module>
  File "protocol/__init__.py", line 1, in <module>
  File "protocol/rpc_protocol.py", line 1, in <module>
  File "protocol/notifications.py", line 1, in <module>
RuntimeError: maximum recursion depth exceeded
�>
MicroPython v1.14-876-gfbecba865 on 2021-05-04; LEGO Technic Large Hub with STM32F413xx
Type "help()" for more information.
>>> 

Operating System Version

MacOS 12.0.1

Mu Version

1.1.0.beta.6

Other Info

No response

Editor Log

No response

@carlosperate
Copy link
Member

That looks like it's possibly an issue with the lego spike library, have you updated the hub to the latest MicroPython release?

If you go to the REPL and type each line by hand, do you get the same error?

@stan-ct
Copy link
Author

stan-ct commented Dec 7, 2021

Sorry. There was something wrong with my code. I didn't know the module name was "hub". I considered it was "spike", the same as Lego official App "SPIKE".
Thanks for your help.

@carlosperate
Copy link
Member

Thanks for the update, in that case we can close this issue.
Glad you were able to resolve it!

@aivarannamaa
Copy link

This error happens when you import spike without importing other dependent modules first. I think LEGO hasn't noticed this (or doesn't care), because they import hub_runtime first in the regular setup.

Assuming you don't want to load the rather heavy hub_runtime, the best work-around I know, is importing _api before importing spike.

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

No branches or pull requests

3 participants