Having an issue with python code and adafruit stepper hat/raspberry pi

python
raspberrypi

#1
#!/usr/bin/python

#import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_Stepper

from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotor


import time

import atexit


# create a default object, no changes to I2C address or frequency

mh = Adafruit_MotorHAT()


# recommended for auto-disabling motors on shutdown!

def turnOffMotors():

    mh.getMotor(1).run(Adafruit_MotorHAT.RELEASE)

    mh.getMotor(2).run(Adafruit_MotorHAT.RELEASE)

    mh.getMotor(3).run(Adafruit_MotorHAT.RELEASE)

    mh.getMotor(4).run(Adafruit_MotorHAT.RELEASE)


atexit.register(turnOffMotors)


# Define 2 stepper motors and set their speed.

StepperA = mh.getStepper(200, 1)  # 200 steps/rev, motor port #1

StepperB = mh.getStepper(200, 1)  # 200 steps/rev, motor port #1

StepperA.setSpeed(30)             # 30 RPM

StepperB.setSpeed(30)             # 30 RPM


try:

  while True:

# wait for a command

    steps = raw_input("How many steps? ")


# Determine direction from sign of step count

    if (steps > 0):

      dir = Adafruit_MotorHAT.FORWARD

      print("forward"),

    else:

      dir = Adafruit_MotorHAT.BACKWARD

      print("backward"),


 # move both in unison - one step at a time

    for i in range(int(abs(steps))):

      StepperA.step(1, dir, DOUBLE)

      StepperB.step(1, dir, DOUBLE)


# End program cleanly with keyboard

except KeyboardInterrupt:

  print "  Quit"

  GPIO.cleanup()

[DEBUG ON]

>>> 

[DEBUG OFF]

>>> 

It never pasted the way it looks on the screen. Hopefully, someone can understand what is going on here.

Thanks,

Robert