Setting up a Sky: bpy.context.world = None I am trying to set up a sky in my script using 
bpy.context.scene.world.use_sky_paper = True which results in the following error:

AttributeError: 'NoneType' object has no attribute 'use_sky_paper'


Why does bpy.context.scene.world return None? Is there some setup required for the world?

I encountered a similar problem, when trying to see which area is active via bpy.context.area.type where area is None. 

Update: bpy.context.area is always None when running script headless.
If not set scene.world is None.  Simply set it, for example to a world named "World" with scene.world = bpy.data.worlds.get("World") , or create a new one.

import bpy

scene = bpy.context.scene

if scene.world is None:
    # create a new world
    new_world = bpy.data.worlds.new("New World")
    new_world.use_sky_paper = True
    scene.world = new_world