How to set active scene via Python? I have code to make a copy of my scene.

bpy.ops.scene.new(type='FULL_COPY')
cloneScene = bpy.context.scene
cloneScene.name = 'clone'


I wish to adapt it so that if the .blend contain several scenes, it will make a copy of the scene named 'Scene', i.e. The default scene (in my use case, it is reasonable to suppose this exists).

First thought is to do:

bpy.context.scene = bpy.data.scenes[ 'Scene' ]


Doc on bpy.context here http://www.blender.org/documentation/blender_python_api_2_57_release/bpy.context.html says 'Note that all context values are readonly, but may be modified through the data api or by running operators'

So I assume I cannot do this.

I found a related thread: http://blenderartists.org/forum/archive/index.php/t-201501.html

which recommends:

bpy.data.screens['Default'].scene = bpy.data.scenes['Scene']
bpy.context.screen.scene=bpy.data.scenes['Scene']


But I don't understand what's going on here, so I'm hesitant to blindly copy the code across.  Does each sub-window have an associated screen, so my 3-D view could be viewing one scene whereas the animation view could be looking at another?
Yes, that answer is valid.

You only need one of these 2 lines, they're just a different way to access the Screen data block. A screen datablock defines the layout of editors (which is why there is a selection of "screens" for e.g. UV editing, animation, etc. and you can fully customized that).

Every window (the system window blender runs in) has a screen property. Every screen in turn has a scene property which defines the active editable scene. Both of these properties are selectable at the top of the window by default. The most convenient way to set the screen.scene property is probably via the context:

bpy.context.screen.scene = some_scene