irmen / Pyro5

Pyro 5 - Python remote objects
https://pyro5.readthedocs.io
MIT License
305 stars 36 forks source link

Cannot run filetransfer example #24

Closed PhilReinhold closed 4 years ago

PhilReinhold commented 4 years ago

I'm on windows/py3.7/Pyro5 v5.10

The filetransfer server fails with

File "server.py", line 79, in __init__
host, _ = self.transportServer.sock.getsockname()
ValueError: too many values to unpack (expected 2)

It appears the socket is AF_INET6, so getsockname returns more stuff. Changing line 79 to host = self.transportServer.sock.getsockname()[0], the server runs. The client now fails with

thread Thread-1 getting a blob using regular Pyro call...
thread Thread-2 getting a blob using regular Pyro call...
Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Users\pcreinhold\Miniconda3\lib\site-packages\Pyro5\client.py", line 282, in connect_and_handshake
    sslContext=sslContext)
  File "C:\Users\pcreinhold\Miniconda3\lib\site-packages\Pyro5\socketutil.py", line 283, in create_socket
    sock.connect(connect)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\pcreinhold\Miniconda3\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "C:\Users\pcreinhold\Miniconda3\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "client.py", line 19, in regular_pyro
    data = p.get_with_pyro(blobsize)
  File "C:\Users\pcreinhold\Miniconda3\lib\site-packages\Pyro5\client.py", line 92, in __getattr__
    self._pyroGetMetadata()
  File "C:\Users\pcreinhold\Miniconda3\lib\site-packages\Pyro5\client.py", line 358, in _pyroGetMetadata
    self.__pyroCreateConnection()
  File "C:\Users\pcreinhold\Miniconda3\lib\site-packages\Pyro5\client.py", line 342, in __pyroCreateConnection
    connect_and_handshake(conn)
  File "C:\Users\pcreinhold\Miniconda3\lib\site-packages\Pyro5\client.py", line 304, in connect_and_handshake
    raise errors.CommunicationError(err) from x
Pyro5.errors.CommunicationError: cannot connect to ('fe80::e5fa:d40b:3e2b:ff46', 61120): [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
irmen commented 4 years ago

That permission error is something on your end, most likely your user hasn't got the correct privileges to access the network. What port are you running on? Less than 1024 is likely problematic (unless you have administrator privileges)

The suggested fix for the ipv6 address is sound and I've committed that.