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