1
$\begingroup$

when I create an executable of below python application which has bpy (python API for Blender) with pyinstaller on windows platform, The .exe file does'nt run. But the same program runs from Eclipse IDE.

import bpy

def test_bpy():
    blend_file_path = "Square.blend"
    blend_out_path = "Altered_square.blend"
    bpy.ops.wm.open_mainfile(filepath = blend_file_path)   
    bpy.ops.mesh.primitive_cube_add(location = (0, 4, 0))  
    bpy.ops.wm.save_mainfile(filepath = blend_out_path, check_existing=True, filter_blender=True)

if __name__ == '__main__':
    test_bpy()

The errors thrown are:

command prompt output

and also this

program stopped working

$\endgroup$
  • $\begingroup$ When you build blender as a module, you get bpy.so as well as a folder that contains many python scripts, maybe this folder does not get copied over. For example site-packages/2.79/datafiles/locale/... and site-packages/2.79/scripts/modules/... While you could leave out the addons folder, the modules and startup folders would be needed. $\endgroup$ – sambler Sep 28 '18 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.