I’ve searched various forums for an answer to this, so I hope it hasn’t been asked before.
I want to load a .obj file called “male.obj”. Here’s the code:
import bpy from bpy import context from math import sin, cos, radians import os # establish path to model directory path_to_directory = os.path.join( '~/', 'Users', 'jackburker', 'Documents', 'Code', 'Blender', 'base_models') path_to_file = os.path.join(path_to_directory, "male.obj") # Print paths for debug print(path_to_directory) print(path_to_file) # Import correct-gender base model bpy.ops.import_scene.obj(filepath=path_to_file)
When run from the scripting console, that last line causes an error. Commented out, the script runs (though with no output). Uncommented, I get the message “Python script fail, look in the console for now…”
In Blender 2.77, on OS X El Capitan, I can’t find a system console to open. If I “open blender.app” from the terminal, it doesn’t follow the process or give any output; it just opens the app.
I’ve checked the documentation and, as far as I can tell, I’m using the import_scene function correctly.
Any ideas? I’m profoundly stuck.