Long paths in Python on Windows

Well it seems that, as always, I’ve found the answer to what’s been bugging me for a week twenty minutes after I seriously ask somebody about it.

So I’ve found that I need to make sure two things are done correctly:

  1. The path can contain only backslashes, no forward slashes.
  2. If I want to do something like list a directory, I need to end the path with a backslash, otherwise Python will append /*.* to it, which is a forward slash, which is bad.

Hope at least someone will find this useful.

Leave a Comment