Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/799#discussion_r12761591
--- Diff: bin/pyspark ---
@@ -52,13 +58,35 @@ export
PYTHONPATH=$SPARK_HOME/python/lib/py4j-0.8.1-src.zip:$PYTHONPATH
export OLD_PYTHONSTARTUP=$PYTHONSTARTUP
export PYTHONSTARTUP=$FWDIR/python/pyspark/shell.py
+# If IPython options are specified, assume user wants to run IPython
if [ -n "$IPYTHON_OPTS" ]; then
IPYTHON=1
fi
-# Only use ipython if no command line arguments were provided [SPARK-1134]
-if [[ "$IPYTHON" = "1" && $# = 0 ]] ; then
- exec ipython $IPYTHON_OPTS
+# Build up arguments list manually to preserve quotes. We export Spark
submit arguments as an
+# environment variable because shell.py must run as a PYTHONSTARTUP
script, which does not take
+# in arguments. This is required mainly for IPython notebooks.
+
+PYSPARK_SUBMIT_ARGS=""
+whitespace="[[:space:]]"
+for i in "$@"; do
+ if [[ $i =~ $whitespace ]]; then
+ i=\"$i\"
--- End diff --
(If you try it with the latest commit, `shlex` will throw an exception
because it receives
an odd number of quotes: `--master foo -name "something " funny"`)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---