diff --git a/scripts/build_all_exercises_page.py b/scripts/build_all_exercises_page.py index d669186..5c010ea 100644 --- a/scripts/build_all_exercises_page.py +++ b/scripts/build_all_exercises_page.py @@ -6,7 +6,7 @@ print("\nBuilding all_exercises_challenges.html...") -path_to_notebooks = '/srv/projects/intro_programming/intro_programming/notebooks/' +path_to_notebooks = '../notebooks/' # Work through notebooks in the order listed here. filenames = ['var_string_num.html', 'lists_tuples.html', diff --git a/scripts/build_index.py b/scripts/build_index.py index 37a3557..d7eeb13 100644 --- a/scripts/build_index.py +++ b/scripts/build_index.py @@ -1,9 +1,9 @@ from jinja2 import Environment, FileSystemLoader # Load index template. -my_template_path = '/srv/projects/intro_programming/intro_programming/notebooks/my_templates' -my_template_base_path = '/srv/projects/intro_programming/intro_programming/notebooks' -ipython_template_path = '/srv/projects/intro_programming/venv/lib/python3.4/site-packages/IPython/nbconvert/templates/html' +my_template_path = '../notebooks/my_templates' +my_template_base_path = '../notebooks' +ipython_template_path = '../../venv/lib/python3.4/site-packages/IPython/nbconvert/templates/html' my_loader = FileSystemLoader( [my_template_path, my_template_base_path, ipython_template_path]) @@ -12,7 +12,7 @@ index_template = my_loader.load(env, 'index.tpl') # Render template to file. -notebooks_path = '/srv/projects/intro_programming/intro_programming/notebooks/' +notebooks_path = '../notebooks/' filepath = notebooks_path + 'index.html' with open(filepath, 'w') as f: f.write(index_template.render()) diff --git a/scripts/highlight_code.py b/scripts/highlight_code.py index 4c6eae9..0844206 100644 --- a/scripts/highlight_code.py +++ b/scripts/highlight_code.py @@ -37,7 +37,7 @@ # Find all files to work with. # Replace with your path. -path_to_notebooks = '/srv/projects/intro_programming/intro_programming/notebooks/' +path_to_notebooks = '../notebooks/' filenames = [] for filename in os.listdir(path_to_notebooks): @@ -52,7 +52,7 @@ for filename in filenames: # Grab the lines from this html file. - f = open(path_to_notebooks + filename, 'r') + f = open(path_to_notebooks + filename, 'r', encoding='utf8') lines = f.readlines() f.close() diff --git a/scripts/remove_input_references.py b/scripts/remove_input_references.py index 2ab8878..d0f1e9e 100644 --- a/scripts/remove_input_references.py +++ b/scripts/remove_input_references.py @@ -9,7 +9,7 @@ print("\nStripping input reference numbers from code cells...") # Find all files to work with. -path_to_notebooks = '/srv/projects/intro_programming/intro_programming/notebooks/' +path_to_notebooks = '../notebooks/' filenames = [] for filename in os.listdir(path_to_notebooks): if '.html' in filename and filename != 'index.html': @@ -20,7 +20,7 @@ for filename in filenames: - f = open(path_to_notebooks + filename, 'r') + f = open(path_to_notebooks + filename, 'r', encoding='utf8') lines = f.readlines() f.close() diff --git a/scripts/show_hide_output.py b/scripts/show_hide_output.py index 5b39fcd..76e6f1f 100644 --- a/scripts/show_hide_output.py +++ b/scripts/show_hide_output.py @@ -6,7 +6,7 @@ import sys # Find all files to work with. -path_to_notebooks = '/srv/projects/intro_programming/intro_programming/notebooks/' +path_to_notebooks = '../notebooks/' filenames = [] for filename in os.listdir(path_to_notebooks): if '.html' in filename and filename != 'index.html': @@ -35,7 +35,7 @@ def generate_show_hide_all_buttons(): # Determine which files have output. Only add buttons to files with output. files_with_output = [] for filename in filenames: - f = open(path_to_notebooks + filename, 'r') + f = open(path_to_notebooks + filename, 'r', encoding='utf8') lines = f.readlines() f.close() @@ -51,7 +51,7 @@ def generate_show_hide_all_buttons(): # This is after second div.container element for filename in files_with_output: container_number = 0 - f = open(path_to_notebooks + filename, 'r') + f = open(path_to_notebooks + filename, 'r', encoding='utf-8') lines = f.readlines() f.close()