Yes, you did.
 
The argument to renameTo is newfile, not dest.
You should also use / instead of \.
 
Regards,
Nico


 
On 11/23/05, Mathias Tirtasana <mathias.tirtasana@uni-muenster.de> wrote:
Thanks for the answer but this also does not work:

from java import io

src   = "D:\test.txt"
dest = "D:\test2.txt"
oldfile = io.File(src)
newfile = io.File(dest)
oldfile.renameTo(dest)

Did I do something wrong???

Mathias

Jeff Emanuel schrieb:
> A workaround is to use java.io.File.renameTo.
>
> Mathias Tirtasana wrote:
>> Hi folks,
>> I am trying to rename a file with jython but it returns :
>> OSError: [Errno 0] couldn't rename file:
>> I read in the FAQ that some functionaltiy of the os module is not
>> implemented, but is the rename function?
>> Or is there an onboard workaround?
>>
>> Greetings
>> Mathias
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
>> Register for a JBoss Training Course.  Free Certification Exam
>> for All Training Attendees Through End of 2005. For more info visit:
>> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
>> _______________________________________________
>> Jython-users mailing list
>> Jython-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jython-users
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
> Register for a JBoss Training Course.  Free Certification Exam
> for All Training Attendees Through End of 2005. For more info visit:
> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
> _______________________________________________
> Jython-users mailing list
> Jython-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jython-users


--
Dipl. Inf. (FH) Mathias Tirtasana
Westfaelische Wilhelms-Universitaet Muenster
Zentrum fuer Informationsverabeitung (ZIV)
Röntgenstraße 9 -13
D-48149 Muenster
E-Mail:  mathias.tirtasana@uni-muenster.de
Telefon: +49 251 83 -31626



-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&opclick
_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users