在django应用程序中使用rpy抛出RPy_Exception:R函数“get”未找到

时间:2012-02-23 09:39:39

标签: django rpy2 rpython

这是追溯(复制粘贴):

Traceback Switch to copy-and-paste view

/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py in get_response
                    response = middleware_method(request) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/middleware/common.py in process_request
            if (not _is_valid_path(request.path_info, urlconf) and ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/middleware/common.py in _is_valid_path
        urlresolvers.resolve(path, urlconf) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py in resolve
    return get_resolver(urlconf).resolve(path) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py in resolve
                    sub_match = pattern.resolve(new_path) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py in resolve
                    sub_match = pattern.resolve(new_path) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py in resolve
            return ResolverMatch(self.callback, args, kwargs, self.name) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py in _get_callback
            self._callback = get_callable(self._callback_str) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/utils/functional.py in wrapper
        result = func(*args) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py in get_callable
                lookup_view = getattr(import_module(mod_name), func_name) ...
▶ Local vars
/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py in import_module
    __import__(name) ...
▶ Local vars
/home/harsh/minip-server/website/Video_Performance/views.py in <module>
import datetime,rpy ...
▶ Local vars
/usr/lib/python2.6/dist-packages/rpy.py in <module>
r = R() ...
▶ Local vars
/usr/lib/python2.6/dist-packages/rpy.py in __init__
        self.get = _rpy.get_fun('get')  # this must happen before any calls to self or its methods! ...
▶ Local vars

有任何线索吗?

修改 的: 这是代码

import rpy

不要误会我的意思,这就是错误发生的路线。我尝试了一个单独的python提示符,import rpy没有失败。只有在网站上它才会失败。为什么呢?

1 个答案:

答案 0 :(得分:0)

这可能是一个多线程问题。对R的并发访问是不好的(在“不要越过流,这将是坏的”意义上)。 rpy2有一个锁定机制,它应该在它即将发生时引发异常。