Re: Rename file if it exists.

2009-10-17 Thread Stephen Reese
> Clearly, the os.path.isfile() is never returning true, because once it does, > you'll get a string error on the next line.  You need > >     fn = basename + "." + str(count) > > or something similar. > > Anyway, isfile() needs a complete path, there's no way it can guess what > directory you plan

Re: Rename file if it exists.

2009-10-16 Thread Dave Angel
Stephen Reese wrote: The script is working and appending the date to newly uploaded files but it is not adding the count? Any recommendations? Is the problem due to os.path.isfile(fn): being just the file name and not the full path? Thanks. # strip leading path from file name to avoid

Re: Rename file if it exists.

2009-10-16 Thread Stephen Reese
> This isn't working because the else: is dangling. And I think your logic is > flawed (I might be wrong of course) because you rename the *existing* file > instead of giving the new one a new data. > > Thus e.g. a link to the file (if it's a webserver) will suddenly deliver a > different file. I d

Re: Rename file if it exists.

2009-10-16 Thread Stephen Reese
> This isn't working because the else: is dangling. And I think your logic is > flawed (I might be wrong of course) because you rename the *existing* file > instead of giving the new one a new data. > > Thus e.g. a link to the file (if it's a webserver) will suddenly deliver a > different file. I d

Re: Rename file if it exists.

2009-10-16 Thread Diez B. Roggisch
Stephen Reese schrieb: The script below uploads files to a web server. Currently it overwrites a file if it already exists. I'm instead trying to rename the old file with an appended date/timestamp before the new file is uploaded. I *think* I have the idea down but it's not be implemented in the

Rename file if it exists.

2009-10-16 Thread Stephen Reese
The script below uploads files to a web server. Currently it overwrites a file if it already exists. I'm instead trying to rename the old file with an appended date/timestamp before the new file is uploaded. I *think* I have the idea down but it's not be implemented in the script correctly. Any hin