Message18750
| Author |
vimboss |
| Recipients |
| Date |
2003年10月24日.11:44:04 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
Invoking os.makedirs() with an argument that contains a
directory name with a single dot fails. The resulting
error is confusing: "File exists".
The problem is that the path is split up in pieces and
an attempt is made to create the "." directory. This
always exists, of course. It happens anyway, because
the test for existence is done before creating the
directory that contains ".".
There are various possible solutions:
1. First normalize the path so that "." entries are
removed. This would also work for ".." entries. But
it might cause trouble for symbolic links and there is
a performance penalty.
2. Check for existence of the directory again after the
recursive call to create the directory that contains
the entry. This will cause the normal error for an
existing directory to be skipped, unless an extra flag
is added. This gets complicated.
3. Simply skip creating a directory with the name ".".
I propose to use the third solution. I have attached a
patch for this. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2007年08月23日 14:17:51 | admin | link | issue829532 messages |
| 2007年08月23日 14:17:51 | admin | create |
|