"python3_sandbox" error

"python3_sandbox" error

von Lucas Rodrigues -
Anzahl Antworten: 7

Hi!

Recently the Moodle I use was updated and after that I can't use "python3_sandbox" type questions. Moodle gives the following error: "Failed to run tests. Broken question (missing prototype 'python3_sandbox'). Cannot be run."

Before that, I imported this type of question through the question bank, and in some questions I was able to use a coderunner question as a Python IDE (this is extremely useful when using very simple questions and at the beginning of the course), but after upgrading from Moodle, I can't use this type of question.

I've already tried to import the question again, via the question bank, but without success.

Any tips on how to solve this problem?

PS - I'm not a Moodle administrator, but I'm looking for the solution to be able to correctly guide the administrator.

Hugs,

Lucas

Als Antwort auf Lucas Rodrigues

Re: "python3_sandbox" error

von Richard Lobb -

I'm not quite sure where you got the python3_sandbox question type from. As far as I know I never released it as part of CodeRunner, but obviously it's floating around somewhere and you managed to get hold of it. Fair enough!

I've just put our current in-house version of the question type on github, here: https://github.com/trampgeek/ucquestiontypes/tree/main/python3_sandbox

Try the following:

  1. Create a question bank category PROTOTYPES in your course.
  2. Download the PROTOTYPE .xml question from github.
  3. Import it into your course question bank, in the PROTOTYPES category.
That should solve your problems. If not post back here.

Note that if you or anyone else in your institution wants to use this question type in a different course, you'll either have to duplicate the prototype in the other course(s) or ask a Moodle administrator to move your prototype to a context shared across all courses that need it. Make sure you have only version of the prototype visible in all contexts or you'll get errors.

Richard
Als Antwort auf Richard Lobb

Re: "python3_sandbox" error

von Lucas Rodrigues -

Well, i found the template here: https://coderunner.org.nz/mod/quiz/attempt.php?attempt=6428&cmid=482 and imported it through the question bank. That was enough to use.

Now I tried import the prototype you put in github, but I get an error. The Moodle I use is in Portuguese, but I'll try to translate the error:

"XML error: No value attribute on line 9, char 77. No question present in imported file"

The same error occurs when importing the file "PROTOTYPE_python3_sandbox-20210921-1125.xml" or "questions-COSC131-21S2-Demo of a simple Run any python program question.-20210921-1130.xml"

I don't know if I'm doing something wrong or it's some Moodle setup.

Thanks for the help.

Hugs,
Lucas

Als Antwort auf Lucas Rodrigues

Re: "python3_sandbox" error

von Richard Lobb -

Saving files from github is a bit counter-intuitive. Right-clicking and saving doesn't work. Instead click the link to open the file in the browser, then select the Raw tab and either save that or copy and paste the code into a text editor and save from there. Other way, make sure you give it a .xml extension (Windows will probably unhelpfully make it a .txt file by default).

Als Antwort auf Richard Lobb

Re: "python3_sandbox" error

von Lucas Rodrigues -

Thanks for the tip, now the import worked, but 2 errors are occurring.

When I import the file "PROTOTYPE_python3_sandbox-20210921-1125.xml" and try to use it, the same error that I commented on in the first post occurs.

When I import the file "questions-COSC131-21S2-Demo of a simple Run any python program question.-20210921-1130.xml" and try to use it, I get the error "Stored test results could not be deserialised. Perhaps try regrading?"

I believe it's some coderunner configuration issue in Moodle, but i'm not sure. I'll talk to the Moodle admin to try to update the coderunner.

Hugs,
Lucas


Als Antwort auf Lucas Rodrigues

Re: "python3_sandbox" error

von Richard Lobb -

Ah, now that's interesting. I now suspect that the problem is the opposite of what I thought. It isn't that the prototype is missing, as the error message says, but that you have multiple prototypes of the same name. I think if you try editing one of the offending questions it will tell you the prototype is missing or non-unique, but the error message when you run it simply says "missing". My apologies for the confusing message; I must update it.

My guess is that at some point you reimported the prototype (perhaps while importing other questions), giving your multiple copies. CodeRunner doesn't know which one to use, so gives up.

I suggest you first try finding all possible prototypes, opening each one for editing, and checking the Question type it defines (under Advanced customisation). Delete any duplicates.

In case you haven't already done so, I strongly recommend that you have a single category PROTOTYPES in a course, and make sure that you always put any question prototypes in that category so you can manage them properly.

If you're unable to find the offending prototype, post back and I'll give you a workaround. But solving the problem properly is much the best option.


Als Antwort auf Richard Lobb

Re: "python3_sandbox" error

von Lucas Rodrigues -
Wow! It's working!

In the past I imported the prototype like a question (I thought it was a question) and it worked. Of course, it was the only "question" as an IDE I had.

Now that I've duplicated the question (actually I was duplicating the prototype) which caused the error saying the prototype was missing, while it was actually duplicated.

Now, I deleted all the questions of the "pyton3_sandbox" type, I created a category only for prototypes and I create new questions, normally, but without duplicating the prototype.

thanks for your help and support.

Hugs,
Lucas

Als Antwort auf Lucas Rodrigues

Re: "python3_sandbox" error

von Richard Lobb -

Good to hear!

I'll improve that error message in the next release - sorry about the confusion it generated.