Bpm Timeline script help

Hello
new member here. i hope this is the right place to post this.
im a beginner in blender and know Nothing about python or scripts …
i want to animate on a bpm based timeline in blender
the only solutions i found on the net are scripts
i tried to copy paste the script into the text editor in blender and ran it but got errors that i absolutely dont understand .
my question is . is there a way to have a BPM based time line other then scripts ?
and if scripts are my only chance can someone please tell me how to run this script and make it work?
tnx a lot in advance

import Blender
from Blender import * 

sc=Scene.GetCurrent() 
r=sc.getRenderingContext()

fps = r.fps            
print "frames fps=",fps

#
#  get the internal timeline data
#
tl=sc.getTimeLine() 


#
endframe = Blender.Get('endframe')
print 'endframe',endframe


#####################
#
# set BPM here

BPM = 120

##############

TS = 4           
#

bps = BPM / 60                # bps = beats / second
print 'bps ',bps

TICKS = (fps / bps)- 1	  # e.g 30fps / 2bps (120 bpm) =  Quarter note (beat) every 15 frames

print 'ticks = ',TICKS


#  delete all previous markers

def eraseMarkers():
	for i in range(1,endframe,1):
		#print 'delete',i
		tl.delete(i)


#   add major beats

def majBeat():
	for i in range(1,endframe,TICKS):
		tl.add(i)                          #### add a marker to the timeline
		tl.setName(i,'Q')               ##  name the marker
		#print i


#
#  "subBeats" .e.g  8th, 16th notes 
#
def subBeat(subBeatStr):
	subTickVal = eval(subBeatStr)
	print 'subTickVal',subTickVal
	subTick = TICKS / (subTickVal / TS)
	print 'subBeat: subTick = ',subTick
	for i in range(1,endframe,subTick):
		tl.add(i)
		tl.setName(i,subBeatStr)
		#print i

eraseMarkers()

#
# do the subBeats first, then major beats writes over top
#  ... crude but simple :)

#
#  if you want "sub beats ( 8, 16, etc add them here)
#  or uncomment (remove the '#' at the beggining of the line

 subBeat('8')
# subBeat('16')

majBeat()
Window.RedrawAll()