librelist archives

« back to archive

Force overwrite in the save() method?

Force overwrite in the save() method?

From:
Adam Hogan
Date:
2012-12-23 @ 21:22
I'm using the following call in wand:

with Image(file=file) as img:
     x = 275
     y = 275
     img.resize(x,y)
     img.save(filename="path/filename_already_exists.png")

When the filename does not already exist, this works.  But it seems 
img.save() does not overwrite an existing image.  Is there a way to 
force this behavior?  I previously had:

file.save("path/filename_already_exists.png")

...using I guess Werkzeug and Flask file-saving defaults, and this did 
successfully overwrite the file.

Thanks!
Adam

Re: [wand] Force overwrite in the save() method?

From:
Hong Minhee
Date:
2012-12-24 @ 00:53
Hi Adam,

I couldn’t reproduce it — it works for me.  Or your program may have not 
enough permission to overwrite the file.  How does the following modified 
one work?

https://gist.github.com/4366932

Regards,
Hong Minhee


On Monday, December 24, 2012 at 6:22 AM, Adam Hogan wrote:

> I'm using the following call in wand:
>  
> with Image(file=file) as img:
> x = 275
> y = 275
> img.resize(x,y)
> img.save(filename="path/filename_already_exists.png")
>  
> When the filename does not already exist, this works. But it seems  
> img.save() does not overwrite an existing image. Is there a way to  
> force this behavior? I previously had:
>  
> file.save("path/filename_already_exists.png")
>  
> ...using I guess Werkzeug and Flask file-saving defaults, and this did  
> successfully overwrite the file.
>  
> Thanks!
> Adam


Re: [wand] Force overwrite in the save() method?

From:
Adam Hogan
Date:
2012-12-27 @ 18:01
Hi Hong---sorry you are entirely right.  I had an error elsewhere.  This 
works fine.  Thank you for the help!

Adam

On 12/23/2012 07:53 PM, Hong Minhee wrote:
> Hi Adam,
>
> I couldn’t reproduce it — it works for me.  Or your program may have not
enough permission to overwrite the file.  How does the following modified 
one work?
>
> https://gist.github.com/4366932
>
> Regards,
> Hong Minhee
>
>
> On Monday, December 24, 2012 at 6:22 AM, Adam Hogan wrote:
>
>> I'm using the following call in wand:
>>   
>> with Image(file=file) as img:
>> x = 275
>> y = 275
>> img.resize(x,y)
>> img.save(filename="path/filename_already_exists.png")
>>   
>> When the filename does not already exist, this works. But it seems
>> img.save() does not overwrite an existing image. Is there a way to
>> force this behavior? I previously had:
>>   
>> file.save("path/filename_already_exists.png")
>>   
>> ...using I guess Werkzeug and Flask file-saving defaults, and this did
>> successfully overwrite the file.
>>   
>> Thanks!
>> Adam
>
>