How solve "AttributeError: 'NoneType' object has no attribute 'ui_type'"?
bpy as a python module is headless

There is no ui associated with bpy that is compiled as a python module. Objects like screen area and region are part of the UI which being non existent, are given the value None.