mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-31 03:59:25 +00:00
remove Value error "pyspark is not installed. Please install it with `pip i… (#9723)
Description: You cannot execute spark_sql with versions prior to 3.4 due to the introduction of pyspark.errors in version 3.4. And if you are below you get 3.4 "pyspark is not installed. Please install it with pip nstall pyspark" which is not helpful. Also if you not have pyspark installed you get already the error in init. I would return all errors. But if you have a different idea feel free to comment. Issue: None Dependencies: None Maintainer: --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
30151c99c7
commit
d04fe0d3ea
@ -179,14 +179,8 @@ class SparkSQL:
|
||||
|
||||
If the statement throws an error, the error message is returned.
|
||||
"""
|
||||
try:
|
||||
from pyspark.errors import PySparkException
|
||||
except ImportError:
|
||||
raise ValueError(
|
||||
"pyspark is not installed. Please install it with `pip install pyspark`"
|
||||
)
|
||||
try:
|
||||
return self.run(command, fetch)
|
||||
except PySparkException as e:
|
||||
except Exception as e:
|
||||
"""Format the error message"""
|
||||
return f"Error: {e}"
|
||||
|
Loading…
Reference in New Issue
Block a user