5
$\begingroup$

I'm trying to save an image to a path which the user can choose, but I always get the error-message:

line 64, in execute image.save_render(path+"output/Image0"+str(counter)+".png", scene) RuntimeError: Error: Could not write image '//../../../testOut/output/Image00.png'

here's how the var path is set:

path = bpy.props.StringProperty(default="/", subtype="FILE_PATH")

[...]

path = self.path

scene.render.image_settings.file_format='PNG'
image.save_render(path+"output/Image0"+str(counter)+".png", scene)
$\endgroup$

1 Answer 1

7
$\begingroup$

image.save_render() cannot use relative paths, which are returned by default by "FILE_PATH" StringProperties. To convert the path to absolute, you can simply do:

path = bpy.path.abspath(self.path)
$\endgroup$
1
  • 1
    $\begingroup$ @user5602 If this answer has satisfactorily answered your question, consider marking it as accepted by clicking the checkmark next to it :) $\endgroup$
    – gandalf3
    Commented Aug 13, 2014 at 19:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .