I have a user-made Matlab script in the same directory as my views.py page, but when it is called I receive the error: Undefined function 'getRecs' for input arguments of type 'double'.
Basically the script wasn't found.
When I test the script with a test.py script in the same directory everything works fine, but when called through the views.py via my browser and the development server the error appears.
tools.py:
def get_recs(passed_list): eng = matlab.engine.start_matlab() recs = eng.getRecs(passed_list) return recs
test.py: (works fine and is in same directory as views.py and getRecs.m) (Ran using Pydev's run as: Python run)
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: (throws error)
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))
I'm using Python 2.7, Django 1.9, and Matlab R2015b