Github user twneale commented on the pull request:

    https://github.com/apache/spark/pull/5173#issuecomment-113541699
  
    Looks like this is originating from the socket module
    https://github.com/python/cpython/blob/master/Lib/socket.py. the .makefile
    method only allows r w and b modes, probably in both 2.x and 3.x. I wonder
    if that particular socket is usually a UNIX socket, but falls back to tcp
    on windows. Rilut does your spark installation work with python 2.7?
    
    On Fri, Jun 19, 2015, 3:34 AM rilut <[email protected]> wrote:
    
    > I'm on Python 3.4.3 (Anaconda 2.2.0 64-bit, Windows 10 x64) and
    > experiencing a problem.
    >
    > >>> sc.parallelize([1, 2]).count()
    > ....
    > File "C:\Anaconda3\lib\socket.py", line 205, in makefile
    > raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
    > ValueError: invalid mode 'a+' (only r, w, b allowed)
    > 15/06/19 14:10:54 WARN PythonRDD: Incomplete task interrupted: Attempting 
to kill Python Worker
    > ....
    >
    > I think it's because of
    > https://github.com/apache/spark/blob/master/python/pyspark/worker.py#L149
    > .
    > I'm not sure if a+ mode exists in Python 3.
    >
    > >>> import socket
    > >>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    > >>> sock.connect(("127.0.0.1", 4040))
    > >>> sock_file = sock.makefile("a+", 65536) ## failed
    > Traceback (most recent call last):
    >   File "<stdin>", line 1, in <module>
    >   File "C:\Anaconda3\lib\socket.py", line 205, in makefile
    >     raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
    > ValueError: invalid mode 'a+' (only r, w, b allowed)
    > >>> sock_file = sock.makefile("r", 65536) ## r is okay
    > >>> sock_file = sock.makefile("x", 65536) ## x is obviously doesn't 
exists, I'm making this up.
    > Traceback (most recent call last):
    >   File "<stdin>", line 1, in <module>
    >   File "C:\Anaconda3\lib\socket.py", line 205, in makefile
    >     raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
    > ValueError: invalid mode 'x' (only r, w, b allowed)
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/spark/pull/5173#issuecomment-113410652>.
    >



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