1

I was trying to make a robot that is controllable using a keyboard. However, it keeps saying already installed modules (like six) cannot be imported: The error

Putting print(help('modules')) in my code to list modules reports: What the program reports However, if i do the same via SSH, it shows a lot more (including six) What python reports via SSH Whats going on? Why cant i use everything? Please help.

1
  • Your question would be more clear if you shared contents of main.py as well as the full command you used to start the Python REPL. Commented Oct 14 at 15:35

1 Answer 1

6

Your program is running using Pybricks MicroPython, not Python 3. You can tell by the shebang that is the first line of the .py file.

ev3dev has 4 different Python runtimes installed by default.

Python 2:

#!/usr/bin/env python2

Python 3:

#!/usr/bin/env python3

MicroPython

#!/usr/bin/env micropython

Pybricks MicroPython

#!/usr/bin/env pybricks-micropython

And each of these 4 has a different place where modules are stored. And there are usually small incompatibilities, so libraries for one runtime can't run on another runtime without some changes.

So it isn't going to be possible to use a Python 3 module like six in Pybricks MicroPython (or regular MicroPython).

If you need features from both Python 3 and Pybricks MicroPython, you can make two different programs that communicate with each other. Or you could try to find a way to do everything you need with a single runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.