From 8cdfb08c47131ce3438e5faf1222af2039424324 Mon Sep 17 00:00:00 2001 From: Nick Pentreath Date: Thu, 12 Dec 2013 13:08:59 +0200 Subject: Fix 'IPYTHON=1 ./pyspark' throwing 'ValueError: Cannot run multiple SparkContexts at once' --- pyspark | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyspark b/pyspark index 4941a36d0d..18f668ec97 100755 --- a/pyspark +++ b/pyspark @@ -59,8 +59,7 @@ if [ -n "$IPYTHON_OPTS" ]; then fi if [[ "$IPYTHON" = "1" ]] ; then - IPYTHON_OPTS=${IPYTHON_OPTS:--i} - exec ipython "$IPYTHON_OPTS" -c "%run $PYTHONSTARTUP" + exec ipython "$IPYTHON_OPTS" "$@" else exec "$PYSPARK_PYTHON" "$@" fi -- cgit v1.2.3 From bb5277b10a3797c1beeca01c32b287ee79db831d Mon Sep 17 00:00:00 2001 From: Nick Pentreath Date: Sun, 15 Dec 2013 09:39:45 +0200 Subject: Making IPython PySpark compatible across versions <1.0.0. Also cleaned up '-i' option and made IPYTHON_OPTS work --- pyspark | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyspark b/pyspark index 8b34c98578..12cc926dda 100755 --- a/pyspark +++ b/pyspark @@ -59,7 +59,12 @@ if [ -n "$IPYTHON_OPTS" ]; then fi if [[ "$IPYTHON" = "1" ]] ; then - exec ipython "$IPYTHON_OPTS" "$@" + # IPython <1.0.0 doesn't honor PYTHONSTARTUP, while 1.0.0+ does. + # Hence we clear PYTHONSTARTUP and use the -c "%run $IPYTHONSTARTUP" command which works on all versions + # We also force interactive mode with "-i" + IPYTHONSTARTUP=$PYTHONSTARTUP + PYTHONSTARTUP= + exec ipython "$IPYTHON_OPTS" -i -c "%run $IPYTHONSTARTUP" else exec "$PYSPARK_PYTHON" "$@" fi -- cgit v1.2.3