apache/spark — pull request #2071 by abhikalakuntla (2014-08-21 00:29:56+00:00)
Title: addPyFile parameter can be a singular string

The "path" parameter of addPyFile(self, path) would imply that the input is a singular path. However, it currently only accepts a list of paths. This is slightly misleading to the user and so just catch it and type cast it.

This is rather odd because in the tests the parameter to addPyFile is a simple string. But when I execute this code on my machine:
https://gist.github.com/abhikalakuntla/e9d39ebe4062ad463780

It throws a:
```
py4j.protocol.Py4JJavaError: An error occurred while calling o11.addFile.
: java.lang.IllegalArgumentException: / cannot be a directory.
at org.apache.spark.HttpFileServer.addFileToDir(HttpFileServer.scala:67)
at org.apache.spark.HttpFileServer.addFile(HttpFileServer.scala:52)
at org.apache.spark.SparkContext.addFile(SparkContext.scala:790)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:379)
at py4j.Gateway.invoke(Gateway.java:259)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:207)
at java.lang.Thread.run(Thread.java:695)
```
However, this totally works:
https://gist.github.com/abhikalakuntla/a0c3d1a46bca0af5a8b7