< >
So, in my Computer Science 20 class this semester, I was struggling to come up with a paper-free way to run my class. Since we’re in a lab setting, there seemed to be no reason why I couldn’t do all of my marking of their assignments directly on the computer. The one caveat was that although it was easy for me to take in their work (via a simple web form processed by a php script), it was rather tedious to have to find each user’s home folder by browsing by hand through the students on our school network.
To solve this problem, I created a Python script that allows me to select a folder of graded assignments, parses the filenames (more on that in a bit) and automagically tosses the graded files back into the individual student folders. This is done entirely through having all relevant information as part of the filename. In particular, our network has the students folders all on one drive (V: in this case), and then sorted into year of expected graduation, then finally into their individual network ids. A sample path to a student’s home folder might be:
V:/2009/jbrown/
In order for the Python script to work it’s magic, the submitted files must be saved in the form:
FirstName_LastName_AssnName_NetworkUsername_YearToGraduate_.filetype
Note that the underscores _ between fields (and the trailing underscore prior to the filetype extension) are required to properly parse the filename. You could just instruct the student’s to save their files in this manner, but I’ve got my PHP submission tool anyhow, so I have it save incoming assignments in this manner automatically. Then it is simply a matter of grading the work, running the Python return.py script, and I’m done.
If you’ve had just about enough preamble, you can check out the script either as an HTML formatted document or just the plain text file.
Hopefully someone else can adapt this script to make it work in their environment as well. I’ve kept it all cross-platform, as it uses Tkinter to prompt for the directory and to give info/error messages.
Yet to do:
- change log file format to allow script to check which files in the current directory have already been returned, and skip these files in future runs on the same directory.