Autograder Inputs Not Working for I/O Test in Python

Hi Everyone, I’m getting an NameError when trying to run my inputs to check outputs for a Python file. Here is the autograding.json file that was set through Github Classroom:

{
  "tests": [
    {
      "name": "chickent",
      "setup": "",
      "run": "python main.py",
      "input": "chicken\r\n5\r\n10",
      "output": "chck\r\n25",
      "comparison": "included",
      "timeout": 5,
      "points": 1
    }
  ]
}

Here is the workflow action of the autograding:

This is happening for all my student’s submissions. Any help is appreciated!

1 Like

I’ve run into the same issue testing a a sample assignment with a very simple 2 line “Hello World” program. Any solution to the issue is appreciated.

Hi, I’m not sure what the problem is here but I wonder if it has something to do with the line endings. Can you try removing the \r and use only \n? I’ll give this a shot as well. If that is indeed the problem it is likely something we could account for.

The code that @Mr-Farid is showing is generated by GitHub Classroom in the autograding.json file. I had a similar thing on my code.

My Python test code was:

variable = input()
print("Hello", variable)

For the IO test I had entered in the fields:

Input: Student
Output: Hello Student

Edit: @jeffrafter I will setup a GitHub Classroom assignment with this and can PM the assignment to you (after the outage is over). It’s either an issue or user error (which may need enhancements in the documentation).

@Mr-Farid

It looks like we both had python main.py as our Run Command. For me this is the command I use for Repl.it and other setups as the shell command. Once I finally noticed that, I figured out my issue, so maybe this info will help you or others in the future for Input / Output test setup in Python.

After digging around the documentation I found some info on the Ubuntu machines used in the Auto Grading have both Python 2 and 3 installed. This means if you are trying to setup IO tests the run command is different based on the version of python.

  • Python 3 programs should use python3 filename.py
  • Python 2 programs should use python filename.py

I have not tested the Python 2 Run Command but I did finally get my simple Python 3 assignment to pass the Input/Output Tests.

@jeffrafter

I don’t know if this solves the OP issue, but it does for me.

© 2017 GitHub, Inc.
with by
GitHub Education