1
$\begingroup$

I am writing a simple script that will export a file in blender

CODE

import bpy

bpy.ops.object.select_by_type(type='MESH')
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY')
bpy.ops.export_scene.fbx(filepath="~/Desktop/updatedhouse.fbx", path_mode='RELATIVE')

I am running into the following error and I am not sure how to decipher it.

 line 291, in write
    with open(fn, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '~/Desktop/updatedhouse.fbx'

location: /private/var/folders/48/ptx7wqz138x4_shgs5nk6szm0000gn/T/AppTranslocation/DEB386B3-C3FC-4FAB-B7A2-0954C07B91CF/d/blender.app/Contents/MacOS/../Resources/2.78/scripts/modules/bpy/ops.py:189
$\endgroup$
  • 2
    $\begingroup$ That doesn't look like a valid relative path address. And if it is it probably means the folder you are trying to export to doesn't exist yet $\endgroup$ – Duarte Farrajota Ramos Jun 14 '17 at 23:56
  • $\begingroup$ ~/Desktop? is the defualt desktop path for a Mac. How could it not be valid? $\endgroup$ – luii Jun 15 '17 at 0:00
  • 1
    $\begingroup$ Nevermind you were right. I needed to specify the entire path $\endgroup$ – luii Jun 15 '17 at 0:02
2
$\begingroup$

I needed to specify my entire file path in the filepath parameter of the bpy.ops.export_scene.fbx method.

$\endgroup$
-1
$\begingroup$

Try this:

bpy.ops.export_scene.fbx(filepath = yourpath, use_selection = True)
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.