3
$\begingroup$

I have a StringProperty(subtype="FILE_PATH) and I am trying to make it so the user selects a folder and then a file is saved out to the location, but the filepath comes out looking really funky.

The folder selected is D:\Pictures, what the StringProperty shows is //..\..\. What is going on here?

$\endgroup$
0

1 Answer 1

5
$\begingroup$

// indicates a relative path in Blender.

Make sure you untick Relative Path in the Accept panel of the file browser to make it an absolute path.

Or you can convert a relative path to a absolute path using the built in method bpy.path.abspath(path)

$\endgroup$
2
  • 2
    $\begingroup$ is there a way to make it an absolute path automatically? $\endgroup$ Commented Jan 15, 2015 at 21:57
  • 1
    $\begingroup$ You can globally disable relative paths: User Preferences > File > Relative Paths, it's the first checkbox below the label Save & Load. $\endgroup$
    – CodeManX
    Commented Jan 15, 2015 at 22:43

You must log in to answer this question.

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