Help needed to convert a 2.49 script to 2.5+ for camera creation

Hi,

I’d like to convert this script in something usable with more recent versions of Blender. I don’t know anything of coding but if I understood well, I can’t use this script since the Blender API changed with 2.5+ releases. It’s an old script that should generate the set up of the cameras the way I exported them from sketchup. So if someone could point me what need to be changed to make it work. Thanks in advance.

import Blender

scene = Blender.Scene.getCurrent()
context = scene.getRenderingContext()
context.imageSizeX(1878)
context.imageSizeY(904)


cam1 = Blender.Camera.New('persp', 'cam1')
cam1.setLens(24.4270219496174)
objcam1 = Blender.Object.New('Camera', 'Scene 1')
objcam1.setLocation([0.0, -0.0, 1.0])
objcam1.link(cam1)
scene.link(objcam1)
empcam1 = Blender.Object.New('Empty', 'Scene 1 (Empty)')
empcam1.setLocation([-0.0, 0.0, -0.0])
scene.link(empcam1)
objcam1.makeTrack(empcam1)


cam2 = Blender.Camera.New('persp', 'cam2')
cam2.setLens(24.4270219496174)
objcam2 = Blender.Object.New('Camera', 'Scene 2')
objcam2.setLocation([-0.0, 0.0, 0.0])
objcam2.link(cam2)
scene.link(objcam2)
empcam2 = Blender.Object.New('Empty', 'Scene 2 (Empty)')
empcam2.setLocation([0.0, -0.0, 3.0])
scene.link(empcam2)
objcam2.makeTrack(empcam2)



import bpy

scene = bpy.context.scene
render = scene.render

render.resolution_x = 1878
render.resolution_y = 904

cam1 = bpy.data.cameras.new("cam1")
#cam1.type = 'PERSP' # it's the default
cam1.lens = 24.4270219496174

ob_cam1 = bpy.data.objects.new("Scene 1", cam1)
ob_cam1.location = 0.0, -0.0, 1.0
scene.objects.link(ob_cam1)

emp_cam1 = bpy.data.objects.new("Scene 1 (Empty)", None)
scene.objects.link(emp_cam1)
con = ob_cam1.constraints.new('TRACK_TO')
con.target = emp_cam1
con.track_axis = 'TRACK_NEGATIVE_Z'
con.up_axis = 'UP_Y'


cam2 = bpy.data.cameras.new("cam2")
cam1.lens = 24.4270219496174
ob_cam2 = bpy.data.objects.new("Scene 2", cam2)
scene.objects.link(ob_cam2)

emp_cam2 = bpy.data.objects.new("Scene 2 (Empty)", None)
emp_cam2.location = 0.0, -0.0, 3.0
scene.objects.link(emp_cam2)
con = ob_cam2.constraints.new('TRACK_TO')
con.target = emp_cam2
con.track_axis = 'TRACK_NEGATIVE_Z'
con.up_axis = 'UP_Y'

scene.update()