So I currently have this string: "//..\Desktop\vine.png" However, to use it when loading an image I need the \ to be \\ , so: "//..\\Desktop\\vine.png"

path = "//..\Desktop\vine.png"
image = bpy.data.images.load(path)

I've tried using


however this is what it throws back at me:

enter image description here

For some reason it changes the "v" to "x0b" and doesn't change the last \ to a \\

Anyone have any ideas why this might be? Or any other methods to change the \ to \\

  • $\begingroup$ I did some more tests, it seems like it doesn't work if the image starts with following letters: v, n, b, x, f, a, u $\endgroup$ – Nils Söderman May 12 '15 at 11:46
  • 1
    $\begingroup$ use path = "//..\Desktop\\vine.png" or path = r"//..\Desktop\vine.png" $\endgroup$ – Jaroslav Jerryno Novotny May 12 '15 at 12:04
  • $\begingroup$ the path is generated, do you know if there is a way to use the r if path is a variable? like: bpy.path.abspath(r + path) ? $\endgroup$ – Nils Söderman May 12 '15 at 12:18
  • 1
    $\begingroup$ s = s.replace("\\", "\\\\") -- stackoverflow.com/questions/7262828/… $\endgroup$ – zeffii May 12 '15 at 12:20

Browse other questions tagged or ask your own question.