Ensure HTML path is a file, not a directory
This commit is contained in:
parent
ca0eec0be7
commit
f06bcf5359
@ -1,4 +1,3 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
class main:
|
||||
@ -10,8 +9,8 @@ class main:
|
||||
html_dict = {}
|
||||
html_page_list = os.listdir(location)
|
||||
for html_page in html_page_list:
|
||||
full_path = location + "/" + html_page
|
||||
html_handle = open( full_path , 'r' )
|
||||
html_raw = html_handle.read()
|
||||
html_dict[html_page] = html_raw
|
||||
full_path = os.path.join(location, html_page)
|
||||
if os.path.isfile(full_path): # Ensure it's a file, not a directory
|
||||
with open(full_path, 'r') as html_handle:
|
||||
html_dict[html_page] = html_handle.read()
|
||||
return html_dict
|
||||
|
Loading…
Reference in New Issue
Block a user