Python programming part is not working in a question inside an Exam

29 views
Skip to first unread message

Javier Ivan Mendoza Aguilar

unread,
Oct 13, 2022, 10:56:05 AM10/13/22
to Numbas Users
Hi everyone, I'm testing a question with a Python programming part. In this question students should write a piece of code to graph a simple equation. To prepare the question  in the preamble I import matplotlib.pyplot as plt and numpy as np. I insert other code stuff needed for the drawing too. The question works pretty well if it's standalone, but when it's inside an Exam the problem appears. 

Traceback (most recent call last): File "/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception File "/lib/python3.10/asyncio/tasks.py", line 232, in __step result = coro.send(None) File "/lib/python3.10/site-packages/_pyodide/_base.py", line 506, in eval_code_async await CodeRunner( File "/lib/python3.10/site-packages/_pyodide/_base.py", line 357, in run_async coroutine = eval(self.code, globals, locals) File "", line 1, in
NameError: name 'plt' is not defined

PD:
In the same question other programming part works as expected, both as standalone and in Exam. This is the preamble for this question

import numpy as np
from scipy.optimize import fsolve


Any help would be appreciated.
Thank you in advance

Christian Lawson-Perfect

unread,
Oct 20, 2022, 10:28:11 AM10/20/22
to numbas...@googlegroups.com
Hi Javier,
Can you give me a link to this question on the editor, please?

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/8c2754e6-2b20-4d7e-b41b-fa0efaef4161n%40googlegroups.com.

Javier Ivan Mendoza Aguilar

unread,
Oct 22, 2022, 10:37:05 PM10/22/22
to Numbas Users
Hi Christian, this is the link to the question:


After many tests, I've been noticing an intermitent problem, sometimes the question works as expected within an Exam.

Christian Lawson-Perfect

unread,
Oct 26, 2022, 8:07:18 AM10/26/22
to numbas...@googlegroups.com
I wonder if this could be due to a network problem. The next time this happens, could you open the browser's developer tool (press the key F12) and give me a copy of what's shown in the Console tab?

Reply all
Reply to author
Forward
0 new messages