Page MenuHome

WITH_PYTHON_MODULE builds crash on `import bpy`
Closed, ArchivedPublic

Description

System Information
Windows 10 Pro x64

Blender Version
Broken: Git latest
Worked: Probably the build before the switch to Python 3.5

Blender can still be built as a Python module, but a catastrophic error occurs when it is imported:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
Color management: using fallback mode for management
Traceback (most recent call last):
  File "C:\Program Files\Python35\2.76\scripts\modules\bpy_types.py", line 25, in <module>
    StructMetaPropGroup = _bpy.StructMetaPropGroup
AttributeError: module '_bpy' has no attribute 'StructMetaPropGroup'
Traceback (most recent call last):
  File "C:\Program Files\Python35\2.76\scripts\modules\bpy_types.py", line 25, in <module>
    StructMetaPropGroup = _bpy.StructMetaPropGroup
AttributeError: module '_bpy' has no attribute 'StructMetaPropGroup'
Traceback (most recent call last):
  File "C:\Program Files\Python35\2.76\scripts\modules\bpy\__init__.py", line 41, in <module>
    from . import utils, path
  File "C:\Program Files\Python35\2.76\scripts\modules\bpy\utils\__init__.py", line 131, in <module>
    import bpy_types as _bpy_types  # keep for comparisons, never ever reload this.
  File "C:\Program Files\Python35\2.76\scripts\modules\bpy_types.py", line 25, in <module>
    StructMetaPropGroup = _bpy.StructMetaPropGroup
AttributeError: module '_bpy' has no attribute 'StructMetaPropGroup'
search for unknown operator 'WM_OT_context_set_enum', 'WM_OT_context_set_enum'
RNA_string_set: OperatorProperties.data_path not found.
RNA_string_set: OperatorProperties.value not found.
search for unknown operator 'WM_OT_context_set_enum', 'WM_OT_context_set_enum'
RNA_string_set: OperatorProperties.data_path not found.
RNA_string_set: OperatorProperties.value not found.
search for unknown operator 'WM_OT_context_set_enum', 'WM_OT_context_set_enum'
RNA_string_set: OperatorProperties.data_path not found.
RNA_string_set: OperatorProperties.value not found.
search for unknown operator 'WM_OT_context_set_enum', 'WM_OT_context_set_enum'
RNA_string_set: OperatorProperties.data_path not found.
RNA_string_set: OperatorProperties.value not found.
search for unknown operator 'WM_OT_context_set_enum', 'WM_OT_context_set_enum'
RNA_string_set: OperatorProperties.data_path not found.
RNA_string_set: OperatorProperties.value not found.
search for unknown operator 'WM_OT_context_set_enum', 'WM_OT_context_set_enum'
RNA_string_set: OperatorProperties.data_path not found.
RNA_string_set: OperatorProperties.value not found.

RNA errors continue to flood the output until Python crashes.

Exact steps for others to reproduce the error
Build Blender as a Python module then run import bpy.

I know that the as-a-module feature isn't supported, but it's important to me as it's how I perform all my automated testing!

Event Timeline

Tom Edwards (artfunkel) raised the priority of this task from to 90.
Tom Edwards (artfunkel) updated the task description. (Show Details)
Tom Edwards (artfunkel) edited a custom field.

@Campbell Barton (campbellbarton), you're maintaining the module, so assigning to you. However Q is: is this feature official enough for the bug tracker?

Sergey Sharybin (sergey) lowered the priority of this task from 90 to Normal.Dec 15 2015, 10:08 AM

Looks like scripts and bpy.so are out of sync. (mixing old scritps with new bpy module).

Line ./release/scripts/modules/bpy_types.py:25 now reads:

StructMetaPropGroup = bpy_types.bpy_struct_meta_idprop

Please confirm that updating script files fixes the problem.

Tom Edwards (artfunkel) changed the task status from Unknown Status to Archived.Dec 18 2015, 9:59 PM

Thanks Campbell, it did. I must have forgotten to run the "install" project.