Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我定期收到此异常:
NotImplementedError: method `at' called on terminated object
在这行代码上:
next if Hpricot(html).at('a')
这个错误是什么意思?我怎样才能避免它?
您正在使用的库使用自定义 C 扩展。在 C 扩展中,它试图调用已被垃圾回收的 Ruby 对象的方法。
这在纯 Ruby 中不会发生,因为垃圾收集器只会释放不再可以从任何引用访问的对象。但是在 C 语言中,可以在垃圾收集器不检查的地方保留对 Ruby 对象的引用(例如,编译器可能已将变量放入 CPU 寄存器中)。
可能是链接问题。检查您是否没有两次链接扩展程序。