Discussion:
Mkdir issues error when directory already exists?
Bill Deegan
2008-11-10 23:57:09 UTC
Permalink
Greetings,

For various reasons I need to create a series of empty directories.
I'm using;
Execute(Mkdir('d:/my/path'))

When that path already exists I get the following messaging from scons:
===========start of example message================
Mkdir("d:\my\path")
scons: *** d:\my\path: Cannot create a file when that file already exists
==========================================

To avoid getting these messages I need to use: os.path.isdir('d:\my\path')

I would expect that Mkdir(anypath) wouldn't issue a such a message unless
the file system object was a file and not an existing directory.

Is this a bug?
I searched the source and it looks like the message must be propagating from
the OS, since I couldn't find the message string.

Thanks,
Bill
Florian Sauer
2008-11-11 04:07:27 UTC
Permalink
Just for info: Ran into the same issue.

The work around using os.path.isdir() sometimes is tricky to apply, since
there may be a lot of targets relying on the same directory and doing the
check in emitter doesn't really work out when you issue the command much
later.

Might as well do a manual os makedir call, but - wait - that defeats the
purpose of having an action in the first place.
Post by Bill Deegan
Greetings,
For various reasons I need to create a series of empty directories.
I'm using;
Execute(Mkdir('d:/my/path'))
===========start of example message================
Mkdir("d:\my\path")
scons: *** d:\my\path: Cannot create a file when that file already exists
==========================================
To avoid getting these messages I need to use: os.path.isdir('d:\my\path')
I would expect that Mkdir(anypath) wouldn't issue a such a message unless
the file system object was a file and not an existing directory.
Is this a bug?
I searched the source and it looks like the message must be propagating
from the OS, since I couldn't find the message string.
Thanks,
Bill
Jamie Kirkpatrick
2008-11-11 07:32:39 UTC
Permalink
Thirded. This one needs looking at.
Post by Florian Sauer
Just for info: Ran into the same issue.
The work around using os.path.isdir() sometimes is tricky to apply, since
there may be a lot of targets relying on the same directory and doing the
check in emitter doesn't really work out when you issue the command much
later.
Might as well do a manual os makedir call, but - wait - that defeats the
purpose of having an action in the first place.
Post by Bill Deegan
Greetings,
For various reasons I need to create a series of empty directories.
I'm using;
Execute(Mkdir('d:/my/path'))
===========start of example message================
Mkdir("d:\my\path")
scons: *** d:\my\path: Cannot create a file when that file already exists
==========================================
To avoid getting these messages I need to use: os.path.isdir('d:\my\path')
I would expect that Mkdir(anypath) wouldn't issue a such a message unless
the file system object was a file and not an existing directory.
Is this a bug?
I searched the source and it looks like the message must be propagating
from the OS, since I couldn't find the message string.
Thanks,
Bill
--
Jamie Kirkpatrick
07818 422311
Greg Noel
2008-11-11 17:37:19 UTC
Permalink
Post by Florian Sauer
Just for info: Ran into the same issue.
The work around using os.path.isdir() sometimes is tricky to apply,
since there may be a lot of targets relying on the same directory
and doing the check in emitter doesn't really work out when you
issue the command much later.
Might as well do a manual os makedir call, but - wait - that defeats
the purpose of having an action in the first place.
Greetings,
For various reasons I need to create a series of empty directories.
Execute(Mkdir('d:/my/path'))
===========start of example message================
Mkdir("d:\my\path")
scons: *** d:\my\path: Cannot create a file when that file already exists
==========================================
To avoid getting these messages I need to use: os.path.isdir('d:\my
\path')
I would expect that Mkdir(anypath) wouldn't issue a such a message
unless the file system object was a file and not an existing
directory.
Is this a bug?
I searched the source and it looks like the message must be
propagating from the OS, since I couldn't find the message string.
Thanks,
Bill
-- Greg Noel, retired UNIX guru
Gary Oberbrunner
2008-11-11 17:45:13 UTC
Permalink
Post by Florian Sauer
Just for info: Ran into the same issue.
The work around using os.path.isdir() sometimes is tricky to apply,
since there may be a lot of targets relying on the same directory and
doing the check in emitter doesn't really work out when you issue the
command much later.
Might as well do a manual os makedir call, but - wait - that defeats
the purpose of having an action in the first place.
This one is on my list to look at. I believe it is the same issue as
#1249, http://scons.tigris.org/issues/show_bug.cgi?id=1249
Florian et al, please let me know if this bug doesn't describe your issue.
--
Gary Oberbrunner
Bill Deegan
2008-11-11 18:12:23 UTC
Permalink
Gary,
Post by Gary Oberbrunner
Post by Florian Sauer
Just for info: Ran into the same issue.
Post by Florian Sauer
The work around using os.path.isdir() sometimes is tricky to apply,
since there may be a lot of targets relying on the same directory and
doing the check in emitter doesn't really work out when you issue the
command much later.
Might as well do a manual os makedir call, but - wait - that defeats
the purpose of having an action in the first place.
This one is on my list to look at. I believe it is the same issue as
#1249, http://scons.tigris.org/issues/show_bug.cgi?id=1249
Florian et al, please let me know if this bug doesn't describe your issue.
Different bug.
This happens if you do just mkdir a directory which already exists.

Likely mkdir -p and it's equivalent on windows should be used.
I'll try and create a simple testcase and submit a bug.

-Bill
Greg Noel
2008-11-11 18:51:02 UTC
Permalink
Post by Gary Oberbrunner
This one is on my list to look at. I believe it is the same issue
as #1249, http://scons.tigris.org/issues/show_bug.cgi?id=1249
No, I think it's http://scons.tigris.org/issues/show_bug.cgi?id=1755
which is assigned to yours truly.

Whichever, the message is only a warning, so it can be ignored.

Hope this helps,
-- Greg Noel, retired UNIX guru

Loading...