Skip to content

Instantly share code, notes, and snippets.

@naotohori
Created June 16, 2020 11:24
Show Gist options
  • Save naotohori/2f63adbe0f45905cc9b5abe17f349cba to your computer and use it in GitHub Desktop.
Save naotohori/2f63adbe0f45905cc9b5abe17f349cba to your computer and use it in GitHub Desktop.
any difference between save_as_mainfile and save_mainfile?
import bpy
bpy.data.objects['Cube'].select_set(True)
bpy.ops.object.delete()
#bpy.ops.wm.save_as_mainfile(filepath='A_new_world_without_the_cube.blend')
# This returns an error
# "ERROR (bke.bpath): /home/sources/buildbot-x86_64-slave/linux_glibc217_x86_64_cmake/blender.git/source/blender/blenkernel/intern/bpath.c:233 BKE_bpath_relative_convert: basedir='', this is a bug"
# although it can successfully generates a file and finishes.
bpy.ops.wm.save_mainfile(filepath='A_new_world_without_the_cube.blend')
# This one does not return the error.
@tobywf
Copy link

tobywf commented Sep 14, 2020

thank you! not sure why, but it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment