Python doesn't see the directories I create
horpner at yahoo.com
Thu Aug 30 15:31:18 CEST 2007
On 2007-08-30, Bruno Desthuilliers <bruno.42.desthuilliers at wtf.websiteburo.oops.com> wrote:
> mr_gadget a écrit :
>> When I create a subfolder, python is not seeing it. Can someone please
>> explain this behaviour ? I just started with python, read the tutorial over
>> the weekend and am writing my very first script. So I may not be seeing
>> something. Both os.path and glob.glob seem not to see a folder I created.
>> Other sibling folders seem to work fine. On a whim I tried paths with \\
>> double slashes and that worked. But why should single slashes work for some
>> folders and not for others ??
> It's a very well known gotcha due to MS's choice to use the
> antislash as path separator. In most languages - Python
> included - the antislash is used for escape sequences
> (non-printable characters).
Keeping in mind which came first, isn't it at least as accurate
to attribute this problem to Python's choice of escape character?
There were probably advantages to adopting the same escape
character as other well-known languages/codes, but the choice has
caused some trouble over the years.
To me, Python's collection of special-purpose string literal
notations is one of its little warts.
Of course, I'm not smart enough to have delivered the ONE TRUE
string literal notation either, but I do have a computer and an
internet connection, so there you are.
More information about the Python-list