【发布时间】:2016-02-11 04:13:06
【问题描述】:
我的views.py 页面在同一目录中有一个用户制作的Matlab 脚本,但是当它被调用时我收到错误:Undefined function 'getRecs' for input arguments of type 'double'. 基本上找不到该脚本。
当我在同一目录中使用 test.py 脚本测试脚本时,一切正常,但当通过浏览器和开发服务器通过 views.py 调用时,出现错误。
tools.py:
def get_recs(passed_list):
eng = matlab.engine.start_matlab()
recs = eng.getRecs(passed_list)
return recs
test.py:(工作正常,与views.py和getRecs.m在同一目录中) (使用 Pydev 的运行方式运行:Python 运行)
from tools import *
test_ratings = [5, 0, 3, 2, 1, 5]
conv_rates = matlab.double(initializer=test_ratings)
new_recs = get_recs(conv_rates)
print_list(new_recs)
views.py:(抛出错误)
from tool import *
test_ratings = [5, 0, 3, 2, 1, 5]
def new_user(request):
conv_rates = matlab.double(initializer=test_ratings)
new_recs = get_recs(conv_rates)
return render_to_response('new_user.html', { 'ratings_list' :new_recs}, context_instance=RequestContext(request))
我正在使用 Python 2.7、Django 1.9 和 Matlab R2015b
【问题讨论】:
标签: python django matlab python-2.7 pydev