Added python2 support

parent 1bccd6c5
......@@ -39,7 +39,7 @@ req_writer.py -Python script that generates req.lp file
4. Dependencies
This system uses s(ASP). s(ASP) and its instalation instructions can be downloaded from http://sourceforge.net/projects/sasp-system/
Python 3 is required to run the two python scripts.
Python is required to run the two python scripts.
5. How To Run an Audit
......
......@@ -4,6 +4,7 @@ This program writes 'main.lp'.
Pass in a transcript in the specified csv format as a command line argument.
"""
from __future__ import print_function
import csv
import re
import sys
......@@ -41,8 +42,8 @@ def main():
sys.exit(1)
# Get list of courses from course.lp
with open('course.lp', 'r') as file:
valid_courses = re.findall('[a-z]+[0-9][0-9V][0-9]{2}', file.read())
with open('course.lp', 'r') as fil:
valid_courses = re.findall('[a-z]+[0-9][0-9V][0-9]{2}', fil.read())
with open('main.lp', 'w') as main_file:
main_file.write("student(%s,%s).\n" % (student, major))
......
......@@ -4,6 +4,7 @@ This program writes writes <bs/ba><major><year>req2.lp.
Pass in the degree major and year as command line arguments.
"""
from __future__ import print_function
import re
import sys
......@@ -24,13 +25,13 @@ def main():
prefix = "%s%s" % (major, year)
# Get list of courses from course.lp
with open('course.lp', 'r') as file:
courses = re.findall('[a-z]+[0-9][0-9V][0-9]{2}', file.read())
with open('course.lp', 'r') as fil:
courses = re.findall('[a-z]+[0-9][0-9V][0-9]{2}', fil.read())
with open(directory + prefix + 'req.lp', 'r') as file:
with open(directory + prefix + 'req.lp', 'r') as fil:
req = file.read()
with open(directory + prefix + 'req2.lp', 'w') as file:
with open(directory + prefix + 'req2.lp', 'w') as fil:
for course in courses:
if not course in req:
file.write('_req(%s,none).\n' % course)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment