Mailing List Archive

os.mkdir()
Hello again,

I couldn't find a resolution in helpfiles, so please
give a hint to my (easy to solve!?) question:

I'd like to create directories under WinNT. There is
already a file with the same name as the directory I want
to create.

Look:
>>>os.mkdir("c:\\blabla")
OSError: [Errno 17] File exists: 'C:\\blabla'

or
>>>os.makedirs("c:\blabla\nana\gugu")
produces
OSError: [Errno 2] No such file or directory: 'c:\blabla\nana'

Don't know if python doing the same under linux, but I need
to solve the problem for every OS!

I think, there must be an easy solution?!

Ciao,
Holger
os.mkdir() [ In reply to ]
Another problem about this:

[source:]
thePath = "c:\\test"
aMode = "0777"
print "...updating filesystem: creating [%s](%s)" % (thePath, aMode)
os.makeDirs(thePath, aMode)

[result and error message:]
...updating filesystem: creating [c:\test](0777)
Traceback (innermost last):
os.makeDirs(thePath, aMode)
AttributeError: makeDirs

What am I doing wrong?
(There's no problem at python-command-line-interpreter!?!)


Thanx for any hints!

Ciao,
Holger
os.mkdir() [ In reply to ]
On Wed, 9 Jun 1999, Holger Jannsen wrote:
> Look:
> >>>os.mkdir("c:\\blabla")
> OSError: [Errno 17] File exists: 'C:\\blabla'
>
> or
> >>>os.makedirs("c:\blabla\nana\gugu")
> produces
> OSError: [Errno 2] No such file or directory: 'c:\blabla\nana'

os.makedirs("c:\\blabla\\nana\\gugu")
^^ ^^ ^^

Double your backslashes.

Oleg.
----
Oleg Broytmann Netskate/Inter.Net.Ru phd@emerald.netskate.ru
Programmers don't die, they just GOSUB without RETURN.
os.mkdir() [ In reply to ]
On Wed, 9 Jun 1999, Holger Jannsen wrote:
> os.makeDirs(thePath, aMode)
> AttributeError: makeDirs

os.makedirs(thePath, aMode)
^

Lowercase...

Oleg.
----
Oleg Broytmann Netskate/Inter.Net.Ru phd@emerald.netskate.ru
Programmers don't die, they just GOSUB without RETURN.
os.mkdir() [ In reply to ]
High,


Oleg Broytmann schrieb:
>
> On Wed, 9 Jun 1999, Holger Jannsen wrote:
> > Look:
> > >>>os.mkdir("c:\\blabla")
> > OSError: [Errno 17] File exists: 'C:\\blabla'
> >
> > or
> > >>>os.makedirs("c:\blabla\nana\gugu")
> > produces
> > OSError: [Errno 2] No such file or directory: 'c:\blabla\nana'
>
> os.makedirs("c:\\blabla\\nana\\gugu")
> ^^ ^^ ^^
>
> Double your backslashes.

Oh, yes, sorry....;-<)))


> Oleg.
> ----
> Oleg Broytmann Netskate/Inter.Net.Ru phd@emerald.netskate.ru
> Programmers don't die, they just GOSUB without RETURN.
os.mkdir() [ In reply to ]
High,

ok, that has been one other fault.
I came even on myself on it, but I was so confused, that I
must have missed that bitch!;-)

Ciao,
Holger

Oleg Broytmann schrieb:
>
> On Wed, 9 Jun 1999, Holger Jannsen wrote:
> > os.makeDirs(thePath, aMode)
> > AttributeError: makeDirs
>
> os.makedirs(thePath, aMode)
> ^
>
> Lowercase...
>
> Oleg.
> ----
> Oleg Broytmann Netskate/Inter.Net.Ru phd@emerald.netskate.ru
> Programmers don't die, they just GOSUB without RETURN.