Fixed to import correct module after rename

parent cd13fc62
......@@ -2,7 +2,7 @@
"""
This file is part of Graduation Audit System.
Copyright (C) 2016 Saikiran Srirangapalli <saikiran1096@gmail.com>
Graduation Audit System is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
......@@ -16,40 +16,32 @@
You should have received a copy of the GNU General Public License
along with Graduation Audit System. If not, see <http://www.gnu.org/licenses/>.
"""
"""
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 sys
import gradaudit
import util
def main():
"""
This program writes 'main.lp'.
Run as:
python3 main_writer.py <transcript>
python main_writer.py <transcript>
"""
if len(sys.argv) != 2:
print("Usage: python main_writer.py /path/to/transcript", file=sys.stderr)
sys.exit(1)
transcript = sys.argv[1]
transcript_file = sys.argv[1]
try:
transcript = open(transcript)
except IOError:
print("error: {} not found".format(transcript), file=sys.stderr)
transcript = util.parse_transcript(transcript_file)
except IOError as err:
print(str(err), file=sys.stderr)
sys.exit(1)
student_data = gradaudit.parse_transcript(transcript)
try:
main_contents = gradaudit.gen_main(*student_data)
main_contents = util.gen_main(transcript)
except IOError as err:
print(str(err), file=sys.stderr)
sys.exit(1)
......
......@@ -2,7 +2,7 @@
"""
This file is part of Graduation Audit System.
Copyright (C) 2016 Saikiran Srirangapalli <saikiran1096@gmail.com>
Graduation Audit System is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
......@@ -18,7 +18,7 @@
"""
from __future__ import print_function
import sys
import gradaudit
import util
def main():
......@@ -39,10 +39,11 @@ def main():
prefix = "%s%s" % (major, year)
# Get list of courses all from course.lp
courses = gradaudit.get_courses()
courses = util.get_courses()
# Get list of required courses for this degre plan
req = gradaudit.get_required_courses(degree, major, year)
# Get list of courses that could satisfy some requirement
with open(directory + prefix + 'req.lp', 'r') as fil:
req = fil.read()
with open(directory + prefix + 'req2.lp', 'w') as fil:
for course in courses:
......
......@@ -22,7 +22,9 @@ import os.path as path
# Container for student academic information
Transcript = namedtuple('Transcript', ['name', 'degree', 'major', 'year', 'spec', 'courses'])
Transcript = namedtuple(
'Transcript', ['name', 'degree', 'major', 'year', 'spec', 'courses'])
def get_package_dir():
"""
......@@ -37,8 +39,9 @@ def parse_transcript(transcript):
and returns and equivalent Transcript object.
"""
try:
csvr = list(csv.reader(transcript))
student = csvr[0][0] # the student's name is on the first line
csvr = list(csv.reader(open(transcript)))
# the student's name is on the first line
student = csvr[0][0]
# extract contents on the second line
(degree, major, year, spec) = csvr[1]
# list of courses student has taken are on the third line
......
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