Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting a "Too many open files - convert" error from Paperclip?

I'm trying to run the clean rake task for paperclip as I've just finished converting all the previous images which were png, into jpg and I keep getting

rake aborted!
Too many open files - convert

I'm sure I have over 10,000 images with 6 variations of styles, any ideas on how to get around this?

like image 493
mediarts Avatar asked Aug 13 '12 16:08

mediarts


1 Answers

See if this answers your question: https://github.com/thoughtbot/paperclip/issues/862

From that thread,

Sikachu (https://github.com/sikachu) said:

"That means you aren't closing the file after assigning to Paperclip. You have to close the file after >assign it to the attachment, as Paperclip clones your file as a Tempfile right after the assignment. >We've done that to prevent undesired behavior (say, trying to rewind the file after you assign it to >Paperclip.)"


file = File.open("foo.jpg")
@user.attachment = file
file.close # totally safe!
like image 175
Banath Avatar answered Oct 24 '22 00:10

Banath