diff --git a/pyspark b/pyspark index 8b34c98578d35adf9643d331fcf2bfe2a52609d1..12cc926ddafa588425f06f8c8da8bc9f64e0dc3d 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