diff --git a/gen.py b/gen.py index e2fb6ee..2d3785e 100644 --- a/gen.py +++ b/gen.py @@ -113,7 +113,7 @@ content_map = { def index_content(dir_name, data_dir, index_txt, desc_txt, template): - print " indexing content -- " + dir_name; + print(" indexing content -- " + dir_name); # desc_txt is a markdown file containing description # for the project - no layout applied to it, only md @@ -124,7 +124,7 @@ def index_content(dir_name, data_dir, index_txt, desc_txt, template): desc_md = markdown.markdown(desc_file.read()); # transform markdown except: - print "error opening description file: " + desc_txt; + print("error opening description file: " + desc_txt); desc_md = None; #return; @@ -137,7 +137,7 @@ def index_content(dir_name, data_dir, index_txt, desc_txt, template): index_file = open(index_txt, 'r+'); content_index = json.loads(index_file.read()); except: - print "error opening index: " + index_txt; + print("error opening index: " + index_txt); content_index = None; #return; @@ -197,13 +197,13 @@ def index_content(dir_name, data_dir, index_txt, desc_txt, template): if __name__ == '__main__': - #fix python markdown utf8 nonsense - reload(sys); - sys.setdefaultencoding('utf8'); + # #fix python markdown utf8 nonsense + # reload(sys); + # sys.setdefaultencoding('utf8'); parse_args(); - print '1/3 - Configuring'; + print('1/3 - Configuring'); # main index template try: @@ -229,7 +229,7 @@ if __name__ == '__main__': print('error creating output file. aborting...'); sys.exit(0); - print '2/3 - Parsing input'; + print('2/3 - Parsing input'); dirs = [d for d in os.listdir(input_dir) if not d == '_system' and os.path.isdir(os.path.join(input_dir,d))]; @@ -244,7 +244,7 @@ if __name__ == '__main__': try: indx = open(indx_txt, 'r+'); except: - print "error opening index: " + indx_txt; + print("error opening index: " + indx_txt); continue; txt = indx.read(); @@ -272,10 +272,10 @@ if __name__ == '__main__': try: dirutil.copy_tree(data_dir, out_data_dir); except: - print "error copying " + data_dir + " to " + out_data_dir + ". Continuing." + print("error copying " + data_dir + " to " + out_data_dir + ". Continuing.") continue; - print '3/3 - Generating ouput'; + print('3/3 - Generating ouput'); html = template.read().replace('[[content]]', content); @@ -286,7 +286,7 @@ if __name__ == '__main__': try: dirutil.copy_tree(style_in, style_out); except IOError as err: - print err; + print(err); # robots.txt? robots_in = os.path.join('.', 'robots.txt') @@ -302,4 +302,4 @@ if __name__ == '__main__': content_indx_template.close(); out.close(); - print 'done.'; \ No newline at end of file + print('done.'); \ No newline at end of file