mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	Allow loading with python < 3.6
Don't rely on recent python features to load models Fixes Issue #1271
This commit is contained in:
		
							parent
							
								
									0aba11b64b
								
							
						
					
					
						commit
						ebf5a3ce59
					
				| 
						 | 
					@ -113,7 +113,7 @@ def load_model(name, **overrides):
 | 
				
			||||||
def load_model_from_link(name, **overrides):
 | 
					def load_model_from_link(name, **overrides):
 | 
				
			||||||
    """Load a model from a shortcut link, or directory in spaCy data path."""
 | 
					    """Load a model from a shortcut link, or directory in spaCy data path."""
 | 
				
			||||||
    init_file = get_data_path() / name / '__init__.py'
 | 
					    init_file = get_data_path() / name / '__init__.py'
 | 
				
			||||||
    spec = importlib.util.spec_from_file_location(name, init_file)
 | 
					    spec = importlib.util.spec_from_file_location(name, str(init_file))
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        cls = importlib.util.module_from_spec(spec)
 | 
					        cls = importlib.util.module_from_spec(spec)
 | 
				
			||||||
    except AttributeError:
 | 
					    except AttributeError:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user