VPL & Turtle

VPL & Turtle

by Garth Brady -
Number of replies: 4

I am attempting to make use of python's turtle module in VPL and running into a challenge.  VPL returns:

The compilation or preparation of execution has failed
======================
It seems you are trying to test a program with a graphic user interface

I have increased the allowed memory to 256Mb and placed the following in vpl_run.sh:

#!/bin/bash
# This file is part of VPL for Moodle - http://vpl.dis.ulpgc.es/
# Script for running Python language
# Copyright (C) 2014 onwards Juan Carlos Rodríguez-del-Pino
# License http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
# Author Juan Carlos Rodríguez-del-Pino <jcrodriguez@dis.ulpgc.es>

# @vpl_script_description Using python3 with the first file
# load common script and check programs
. common_script.sh
check_program python3
get_first_source_file py
cat common_script.sh > vpl_execution
echo "export TERM=ansi" >>vpl_execution
echo "python3 \"$FIRST_SOURCE_FILE\"" >>vpl_execution
chmod +x vpl_execution
mv vpl_execution console_execution
get_source_files py
check_program x-terminal-emulator xterm
cat common_script.sh > vpl_execution
echo "$PROGRAM -e ./console_execution" >> vpl_execution
echo "sleep 5s" >> vpl_execution
echo "wait_end console_execution" >> vpl_execution
mv vpl_execution vpl_wexecution

Average of ratings: -
In reply to Garth Brady

Re: VPL & Turtle

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Dear Garth,
this message appears if you are trying to evaluate a student program running with GUI. I understand that the python turtle module requires a GUI environment.

Some programs with GUI can also interact with the standard input-output streams. I don't know if you want to evaluate the student's program using the standard input-output streams.

Best regards,
Juan Carlos
In reply to Juan Carlos Rodríguez-del-Pino

Re: VPL & Turtle

by Garth Brady -
Hi Juan,

I plan to use the std in/out streams later on, but this program was simply designed to generate a turtle window using python. It runs fine in repl.it or any standard python environment... Not sure what the error is but I've attached a screenshot of what it should produce. Here's the code that produced the error:

import turtle as t

screen = t.Screen()
screen.setup(width = .5, height = .5)

t.forward(200)

t.done()

In reply to Garth Brady

Re: VPL & Turtle

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi Garth,
I attach screenshots of the running of your code and others. This code was tested on Ubuntu 18 and Debian 9.
Beware of not name your code file turtle.py.
Attachment Captura de pantalla 2021-03-10 184322.png
Attachment Captura de pantalla 2021-03-10 184533.png