Problems defining string paths

Hey,
When I start up my Blender application, I need to define some paths to find the sounds and database but python is being a pain.

Lets say that the sounds are located in the directory “sounds”, so the path to that would be ‘sounds’. Now, I can’t define that because I guess it’s expecting another char so it can put in a linebreak or something similar. The exact error is “SyntaxError: EOL while scanning single-quoted string”

I can get past this by writing “sounds\p”[:-1] but surely there is a better way to do this? I can live with it for the variables I’m setting but I want the user to be able to input paths too and obviously this could get in the way of that.

I also know that “sounds/” works for loading text files and sounds, but webbrowser.py can’t deal with a right slash when loading webpages… it reports a missing file D=

I’m running this on a Vista box with python 2.5, Blender 2.45.

Does anyone know a fix to my problem?
Cheers,
Dave

use a double inverted bar \

cyborg_ar is right, but I’m guessing you might want to know why.

The backslash character is used to escape strings in python. So, in your case, when you have a string 'sounds', the second single quote is escaped. So, if you use \ you escape the backslash :wink:

Thanks so much! That works perfectly! And thanks for telling me why that works too =)