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$
6
$\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
    $\begingroup$ @user5602 If this answer has satisfactorily answered your question, consider marking it as accepted by clicking the checkmark next to it :) $\endgroup$ – gandalf3 Aug 13 '14 at 19:22

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.