1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
Logs
AttributeError at /experiment/block/toontje-hoger-1-mozart-2/
'Session' object has no attribute 'section_from_any_song'
Request Method: GET
Request URL: http://localhost:8000/experiment/block/toontje-hoger-1-mozart-2/
Django Version: 4.2.15
Exception Type: AttributeError
Exception Value:
'Session' object has no attribute 'section_from_any_song'
Exception Location: /server/experiment/rules/toontjehoger_1_mozart.py, line 145, in get_image_trial
Raised during: experiment.views.get_block
Python Executable: /usr/local/bin/python
Python Version: 3.11.9
Python Path:
['/server',
'/usr/local/lib/python311.zip',
'/usr/local/lib/python3.11',
'/usr/local/lib/python3.11/lib-dynload',
'/usr/local/lib/python3.11/site-packages']
Server time: Mon, 26 Aug 2024 14:16:28 +0200
Traceback Switch to copy-and-paste view
/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py, line 55, in inner
return inner
else:
@wraps(get_response)
def inner(request):
try:
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
…
except Exception as exc:
response = response_for_exception(request, exc)
return response
return inner
Local vars
/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py, line 197, in _get_response
if response is None:
wrapped_callback = self.make_view_atomic(callback)
# If it is an asynchronous view, run it in a subthread.
if iscoroutinefunction(wrapped_callback):
wrapped_callback = async_to_sync(wrapped_callback)
try:
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
…
except Exception as e:
response = self.process_exception_by_middleware(e, request)
if response is None:
raise
# Complain if the view returned None (a common error).
Local vars
/server/experiment/views.py, line 63, in get_block
"playlists": [{"id": playlist.id, "name": playlist.name} for playlist in block.playlists.all()],
"feedback_info": block.get_rules().feedback_info(),
# only call first round if the (deprecated) first_round method exists
# otherwise, call next_round
"next_round": (
serialize_actions(block.get_rules().first_round(block))
if hasattr(block.get_rules(), "first_round") and block.get_rules().first_round
else serialize_actions(block.get_rules().next_round(session))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
…
),
"loading_text": _("Loading"),
"session_id": session.id,
}
response = JsonResponse(block_data, json_dumps_params={"indent": 4})
Local vars
/server/experiment/rules/toontjehoger_1_mozart.py, line 64, in next_round
Step("Lukt het om het juiste antwoord te vinden?"),
],
step_numbers=True,
button_label="Start",
)
if get_rounds_passed == 0:
round = self.get_image_trial(
…
session,
section_group="1",
image_url=self.QUESTION_URL1,
question=self.get_task_explainer(),
expected_response="B",
)
Local vars
/server/experiment/rules/toontjehoger_1_mozart.py, line 145, in get_image_trial
return [score]
def get_image_trial(
self, session, section_group, image_url, question, expected_response
):
# Config
# -----------------
section = session.section_from_any_song(filter_by={"group": section_group})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
…
if section is None:
raise Exception("Error: could not find section")
# Step 1
# --------------------
Local vars
Environment:
Request Method: GET
Request URL: http://localhost:8000/experiment/block/toontje-hoger-1-mozart-2/
Django Version: 4.2.15
Python Version: 3.11.9
Installed Applications:
['django_extensions',
'admin_interface',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.humanize',
'django.contrib.messages',
'django.contrib.staticfiles',
'nested_admin',
'inline_actions',
'django_markup',
'corsheaders',
'experiment',
'image',
'participant',
'result',
'session',
'section',
'theme',
'question',
'debug_toolbar']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/server/experiment/views.py", line 63, in get_block
else serialize_actions(block.get_rules().next_round(session))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/server/experiment/rules/toontjehoger_1_mozart.py", line 64, in next_round
round = self.get_image_trial(
File "/server/experiment/rules/toontjehoger_1_mozart.py", line 145, in get_image_trial
section = session.section_from_any_song(filter_by={"group": section_group})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception Type: AttributeError at /experiment/block/toontje-hoger-1-mozart-2/
Exception Value: 'Session' object has no attribute 'section_from_any_song'
Description
Some classes are calling a method on the
Session
model class calledsection_from_any_song
, which does not exist (anymore). It seems to have been removed here: https://github.com/Amsterdam-Music-Lab/MUSCLE/pull/1200/files#diff-3eeacba28aaba701a4abe9117ebb9cda67b0af595277b65292aea93c19cd5cb5L151-L164See also here:
https://github.com/search?q=repo%3AAmsterdam-Music-Lab%2FMUSCLE+section_from_any_song&type=code
Screenshots
Reproduction URL
No response
Reproduction steps
Logs