Create camera + path

Hi all,
I am currently working on creating an animation showing segmentation results of my lab. These results are saved as .stl surfaces. My aim is to create a script that will import the 1000 surfaces as well as creating a camera and a bezier circle or curve on which the camera moves along.
I am currently stuck with the camera creation

For my purpose I need to increase the value of clip_end to a very high number. As far as I know I also have to be able to select the camera using something like camera.select=True in order to let it follow the path of a bezier circle (bpy.ops.object.parent_set(type=‘FOLLOW’, xmirror=False, keep_transform=False)). I also need to define a camera location and a constraint whih lets it ‘look’ at an empty. Using the GUI I have no problem of setting all these parameters but neither the Info window nor the API provide enough information for me to do this. I tried

camera=bpy.data.cameras.new(‘Camera’) as well as
camera2=bpy.data.objects.new(‘Camera’, camera)

to do this but both do not suit my needs. Is there anything i misunderstood?
Thank you for your help!

Hey,
sorry for the double post that is my mistake. Maybe some admin could delete the other topic?

I think i might have been a bit consufing in my message above. What I need is the code to:
-create a camera (which should be visible in the 3D View Window)
-set the clip_end value to 9999999999999
-attach it to a bezier circle (parent -> follow path) for getting a camera path
-add a constraint so that it will always look at an empty

I hope you can help me with that because if I create cameras using bpy.data.cameras.new(), bpy.data.cameras.new() or bpy.ops.object.camera_add() I cannot apply all these changes
Thank you very much!

here you go:

import bpy


clip_end = 999999


cam = bpy.data.cameras.new("Cam")
cam.clip_end = clip_end
cam_ob = bpy.data.objects.new("Cam", cam)
bpy.context.scene.objects.link(cam_ob)


empty = bpy.data.objects.new("Emtpy", None)
bpy.context.scene.objects.link(empty)
bpy.context.scene.update()


bpy.ops.curve.primitive_bezier_circle_add()
circle = bpy.context.object
circle.scale *= 10
co = circle.data.splines[0].bezier_points[-1].co * 10
cam_ob.location = co


cam_ob.select = True
bpy.ops.object.parent_set(type='FOLLOW')


con = cam_ob.constraints.new('TRACK_TO')
con.target = empty
con.track_axis = 'TRACK_NEGATIVE_Z'
con.up_axis = 'UP_Y'


for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        area.spaces[0].clip_end = clip_end

Wow thank you that was exactly what I needed!

Hey,
I have one mor equestion. I would also like to alter the amount of frames needed for the camera to move around the circle.

bpy.ops.curve.primitive_bezier_circle_add()
circle = bpy.context.object
circleContext=bpy.context.scene.objects.active

Unfortunately the value of path_duration can only be accessed via the bpy.data.curves[‘someName’].path_duration which is not practicable for my purpose. Is there any ‘link’ between the object BezierCircle to the corresponding curve?
Thank you for your help!

e.g.

circle.data.path_duration = 144

after circle.scale *= 10