'long' object has no attribute 'is_anonymous'

Hi everyone, i’m using edX version ironwood, I have installed edx-proctoring version 2.2.4 into my platform and enable Time Exams feature. The problem is when I click on “I am ready to start this timed exam” label the logs show this error:

Traceback (most recent call last):
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/django/core/handlers/exception.py”, line 41, in inner
lms_1 | response = get_response(request)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py”, line 249, in _legacy_get_response
lms_1 | response = self._get_response(request)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py”, line 187, in _get_response
lms_1 | response = self.process_exception_by_middleware(e, request)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py”, line 185, in _get_response
lms_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/django/utils/decorators.py”, line 185, in inner
lms_1 | return func(*args, **kwargs)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/django/views/decorators/csrf.py”, line 58, in wrapped_view
lms_1 | return view_func(*args, **kwargs)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/django/views/generic/base.py”, line 68, in view
lms_1 | return self.dispatch(request, *args, **kwargs)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/rest_framework/views.py”, line 489, in dispatch
lms_1 | response = self.handle_exception(exc)
lms_1 | File “/openedx/venv/src/edx-proctoring/edx_proctoring/views.py”, line 153, in handle_exception
lms_1 | resp = super(ProctoredAPIView, self).handle_exception(exc)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/rest_framework/views.py”, line 449, in handle_exception
lms_1 | self.raise_uncaught_exception(exc)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/rest_framework/views.py”, line 486, in dispatch
lms_1 | response = handler(request, *args, **kwargs)
lms_1 | File “/openedx/venv/src/edx-proctoring/edx_proctoring/views.py”, line 608, in post
lms_1 | start_exam_attempt(exam_id, request.user.id)
lms_1 | File “/openedx/venv/src/edx-proctoring/edx_proctoring/api.py”, line 742, in start_exam_attempt
lms_1 | return _start_exam_attempt(existing_attempt)
lms_1 | File “/openedx/venv/src/edx-proctoring/edx_proctoring/api.py”, line 781, in _start_exam_attempt
lms_1 | ProctoredExamStudentAttemptStatus.started
lms_1 | File “/openedx/venv/src/edx-proctoring/edx_proctoring/api.py”, line 872, in update_attempt_status
lms_1 | exam_attempt_obj.allowed_time_limit_mins = _calculate_allowed_mins(exam, exam_attempt_obj.user_id)
lms_1 | File “/openedx/venv/src/edx-proctoring/edx_proctoring/api.py”, line 1730, in _calculate_allowed_mins
lms_1 | due_datetime = get_exam_due_date(exam, user_id)
lms_1 | File “/openedx/venv/src/edx-proctoring/edx_proctoring/utils.py”, line 249, in get_exam_due_date
lms_1 | due_date = when_api.get_date_for_block(exam[‘course_id’], exam[‘content_id’], ‘due’, user=user)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/edx_when/api.py”, line 229, in get_date_for_block
lms_1 | return get_dates_for_course(course_id, user).get((_ensure_key(UsageKey, block_id), name), None)
lms_1 | File “/openedx/venv/local/lib/python2.7/site-packages/edx_when/api.py”, line 149, in get_dates_for_course
lms_1 | user_id = user.id if not user.is_anonymous else ‘’
lms_1 | AttributeError: ‘long’ object has no attribute ‘is_anonymous’

Does anyone know how to solve it ?

Hi @huynk!

I haven’t used proctoring before, but it looks like ironwood.master uses edx-proctoring==1.5.7, so it’s probably a version compatibility issue?

Thanks @jill so much for your helping ! ,
The reason due I’m using wrong edx-protoring version, i got edx-protoring==2.2.4, i was looking for the compatibility edx-protoring version with iron.wood before but couldn’t found the guide to do it and maybe i will get a version problem in the future :frowning:

No worries! It is hard to find this information, since most of the details are in the code, not the documentation.

But the release branches do pin versions for their dependencies, so the edx-platform/requirements/edx/ folder is a good place to start.

Hope this version works for you!

1 Like