gpt4 book ai didi

ruby-on-rails-3.1 - 为什么我从 Paperclip 收到 "Too many open files - convert"错误?

转载 作者:行者123 更新时间:2023-12-04 09:00:37 26 4
gpt4 key购买 nike

我正在尝试为回形针运行 clean rake 任务,因为我刚刚完成将所有以前的 png 图像转换为 jpg 并且我不断收到

rake aborted!
Too many open files - convert

我确定我有超过 10,000 张图片,有 6 种不同的风格,关于如何解决这个问题有什么想法吗?

最佳答案

看看这是否能回答您的问题:https://github.com/thoughtbot/paperclip/issues/862

从那个线程,

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!

关于ruby-on-rails-3.1 - 为什么我从 Paperclip 收到 "Too many open files - convert"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11938662/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com