How to resolve nxt-python error "ImportError: No module named 'nxt'"

734 views Asked by At

I am attempting to use nxt-python in order to program a robot.

I installed nxt-python for mac by following these instructions.

After installing it I decided to run one of the example scripts:

#!/usr/bin/env python

import nxt.locator
from nxt.motor import *

def spin_around(b):
    m_left = Motor(b, PORT_B)
    m_left.turn(100, 360)
    m_right = Motor(b, PORT_C)
    m_right.turn(-100, 360)

//The print line was added by me.
print("Script Starting")
b = nxt.locator.find_one_brick()
spin_around(b)

I opened up the .py file with IDLE and clicked "Run -> Run Module". As I was running the script my NXT was turned on and connected by USB. I had also installed PyUSB.

However, I got the error ImportError: No module named 'nxt'

Since I successfully installed nxt-python, why would this occur?

0

There are 0 answers