Jython file manipulation?!
Matthew Bonig
mbonig at hotmail.com
Mon Sep 23 13:28:02 EDT 2002
There are no exceptions raised...
If you look at the source Jython uses for the os.rename function it just
uses Java's File.renameTo()...
that function returns false... which then the os.rename function throws a
OSError exception, but it's not helpful in any way.
The only thing I can think is happening is that I am doing this renaming on
files that are on a netword drive on a win32 box, but I have double
checked... the new filename is NOT there... (since win32 won't overwrite the
new file if it exists, and therefore return an error, but that's not
happening). I've also double checked to make sure I have write permissions
on the network drive, which I most definetly do (I usually write 3-5 files
onto that drive a day).
This is why I thought there might be some sort of security issue with
Jython... I'm pretty sure it's in the Jython side since when I tried exactly
the same thing (os.rename(oldfilename, newFilename)) in python it worked
perfectly.
Thanks
Matthew
"Andreas Ulbrich" <ulbi at ivs.tu-berlin.de> wrote in message
news:amn87j$73a$1 at mamenchi.zrz.TU-Berlin.DE...
> Matthew Bonig wrote:
> > I am trying to rename a file in Jython...
> > the command I am using is just
> > os.rename(filename, newFilename)
>
> This works for me (Jython 2.1, JDK 1.4.1)
>
> You should give us some details, i.e. exceptions etc., to get some
> better answers here.
>
More information about the Python-list
mailing list