Skip to content

Commit

Permalink
Merge pull request #39 from snoe925/main
Browse files Browse the repository at this point in the history
importable spark overrides $SPARK_HOME
  • Loading branch information
minrk authored Feb 11, 2022
2 parents e659cd1 + a9637d0 commit b037bad
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions findspark.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ def find():
spark_home = path
break

# last resort: try importing pyspark (pip-installed, already on sys.path)
try:
import pyspark
except ImportError:
pass
else:
spark_home = os.path.dirname(pyspark.__file__)
if not spark_home:
# last resort: try importing pyspark (pip-installed, already on sys.path)
try:
import pyspark
except ImportError:
pass
else:
spark_home = os.path.dirname(pyspark.__file__)

if not spark_home:
raise ValueError(
Expand Down

0 comments on commit b037bad

Please sign in to comment.