Re: [Tutor] File renaming using os.rename problem (spir)

2009-12-09 Thread spir
Roy Hinkelman dixit: > Why don't you simply print out fname? This should point you to the error. > > Denis > > > I did here: > > if fname == old_name: > > print fname # test > > and it looks correct. > > On an WinXP, should I use shutil instead? > > Roy Sorry Roy, I rea

Re: [Tutor] File renaming using os.rename problem (spir)

2009-12-08 Thread Sander Sweers
On Tue, 2009-12-08 at 14:55 -0800, Roy Hinkelman wrote: > shutil.copy2(_files_to_mod + "\\" + fname, _files_to_mod + "\\" + > new_name) You can make os.path.join sort out the directory seprator for you. It will add a / under linux and \ under windows. >>> os.path.join('Testing dir','oldname dir',

Re: [Tutor] File renaming using os.rename problem (spir)

2009-12-08 Thread Roy Hinkelman
I got it. Switched to shutil and made to paths complete paths. The added benefit is that it didn't trash the original file. shutil.copy2(_files_to_mod + "\\" + fname, _files_to_mod + "\\" + new_name) Thanks. -- Forwarded message -- From: Roy Hinkelman Date: Tue, Dec 8, 2009 at

Re: [Tutor] File renaming using os.rename problem

2009-12-08 Thread Dave Angel
spir wrote: Roy Hinkelman dixit: I can't find anything on this error I am getting when renaming some files. I'm pulling info from a csv file and parsing it to build new file names. Any pointers appreciated Roy My code: # RENAME FILES using META file - new name = [place]_[state]_[sku].tif

Re: [Tutor] File renaming using os.rename problem (spir)

2009-12-08 Thread Roy Hinkelman
Why don't you simply print out fname? This should point you to the error. Denis I did here: > if fname == old_name: > print fname # test and it looks correct. On an WinXP, should I use shutil instead? Roy ___ Tutor maillist - T

Re: [Tutor] File renaming using os.rename problem

2009-12-08 Thread spir
Roy Hinkelman dixit: > I can't find anything on this error I am getting when renaming some files. > I'm pulling info from a csv file and parsing it to build new file names. > > Any pointers appreciated > > Roy > > My code: > # RENAME FILES using META file - new name = [place]_[state]_[sku].tif

[Tutor] File renaming using os.rename problem

2009-12-08 Thread Roy Hinkelman
I can't find anything on this error I am getting when renaming some files. I'm pulling info from a csv file and parsing it to build new file names. Any pointers appreciated Roy My code: # RENAME FILES using META file - new name = [place]_[state]_[sku].tif import re, os, csv # DEFINE _meta_file