Chris Rebert wrote: > On Fri, Feb 20, 2009 at 3:33 PM, Lionel <lionel.ke...@gmail.com> wrote: >> Hello all: >> >> I've crafted several classes and exceptions which I've stored in a >> file called "DataFileType.py". I then invoke them from within other >> files like this: >> >> >> # Top of file >> >> import sys >> sys.path.append("c:\DataFileTypes") > > Recall that the backslash is the escape character in Python and that > therefore you need to put \\ to get a backslash in the resulting path > string. Thus, the path you think you're adding isn't the path that's > getting added. > Alternatively, you can just use forward slashes instead (yes, that > works on Windows from Python). > In fact "\D" isn't a defined escape character, so this particular usage does give the right path, though your general point is good.
>>> "\D" '\\D' >>> len("\D") 2 regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list