mirror of
				https://github.com/searxng/searxng.git
				synced 2025-10-31 02:27:06 -04:00 
			
		
		
		
	[fix] ModuleNotFoundError: No module named 'lxml' (#5254)
When installing SearXNG (e.g.):
    pip install --use-pep517 --no-build-isolation -e .
An import exception is raised:
    ModuleNotFoundError: No module named 'lxml'
The ``setup.py`` file imports ``searx``, which in turn triggers various other
imports.  However, the name XPath is only needed for type checking.
Closes: https://github.com/searxng/searxng/issues/5177
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
			
			
This commit is contained in:
		
							parent
							
								
									7bf65d68c2
								
							
						
					
					
						commit
						34eb32f418
					
				| @ -2,6 +2,8 @@ | ||||
| """Exception types raised by SearXNG modules.""" | ||||
| 
 | ||||
| import typing as t | ||||
| 
 | ||||
| if t.TYPE_CHECKING: | ||||
|     from lxml.etree import XPath | ||||
| 
 | ||||
| 
 | ||||
| @ -40,7 +42,7 @@ class SearxEngineException(SearxException): | ||||
| class SearxXPathSyntaxException(SearxEngineException): | ||||
|     """Syntax error in a XPATH""" | ||||
| 
 | ||||
|     def __init__(self, xpath_spec: str | XPath, message: str): | ||||
|     def __init__(self, xpath_spec: "str | XPath", message: str): | ||||
|         super().__init__(str(xpath_spec) + " " + message) | ||||
|         self.message: str = message | ||||
|         # str(xpath_spec) to deal with str and XPath instance | ||||
| @ -111,7 +113,7 @@ class SearxEngineTooManyRequestsException(SearxEngineAccessDeniedException): | ||||
| class SearxEngineXPathException(SearxEngineResponseException): | ||||
|     """Error while getting the result of an XPath expression""" | ||||
| 
 | ||||
|     def __init__(self, xpath_spec: str | XPath, message: str): | ||||
|     def __init__(self, xpath_spec: "str | XPath", message: str): | ||||
|         super().__init__(str(xpath_spec) + " " + message) | ||||
|         self.message: str = message | ||||
|         # str(xpath_spec) to deal with str and XPath instance | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user