GitHub user abhikalakuntla opened a pull request:

    https://github.com/apache/spark/pull/2071

    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

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/abhikalakuntla/spark patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/2071.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2071
    
----
commit e7ef5efe990094ded452100b53443932447e71ac
Author: Abhi Kalakuntla <[email protected]>
Date:   2014-08-21T00:27:03Z

    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

----


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to