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?

| improve this question | | | | |
$\endgroup$
4
$\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)

| improve this answer | | | | |
$\endgroup$
  • 2
    $\begingroup$ is there a way to make it an absolute path automatically? $\endgroup$ – BlendingJake Jan 15 '15 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 Jan 15 '15 at 22:43

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.