[SOLVED] How set view from camera (as 0 key)

I need to set the view from camera point of view from python script.

How can I set the default camera to “camera view” as pressing 0 key.

Thanks,
Antonio

I have tested this, but something is wrong:

>>> bpy.ops.view3d.viewnumpad(type=‘CAMERA’)
Traceback (most recent call last):
File “<blender_console>”, line 1, in <module>
File “C:\Program Files\Blender Foundation\Blender\2.68\scripts\modules\bpy\ops.py”, line 188, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.view3d.viewnumpad.poll() failed, context is incorrect

I have solved:

http://www.blender.org/forum/viewtopic.php?p=89711&sid=c18d5fe9e5dcc5bb622fa9ad20d53692

[TABLE=“width: 90%, align: center”]

Code:

for area in bpy.context.screen.areas:
if area.type == ‘VIEW_3D’:
area.spaces[0].region_3d.view_perspective = ‘CAMERA’

[/TABLE]