Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

OSError: [Errno 88] Socket operation on non-socket #130

@DAC324

Description

@DAC324

Hello all,

in Manjaro Linux, onedrived gives

onedrived start --debug
Traceback (most recent call last):
  File "/usr/bin/onedrived", line 11, in 
    load_entry_point('onedrived', 'console_scripts', 'onedrived')()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/gerd/Downloads/onedrived-dev/onedrived/od_main.py", line 179, in 
    def main():
  File "/usr/lib/python3.8/site-packages/click/decorators.py", line 115, in decorator
    cmd = _make_command(f, name, attrs, cls)
  File "/usr/lib/python3.8/site-packages/click/decorators.py", line 88, in _make_command
    return cls(name=name or f.__name__.lower().replace('_', '-'),
  File "/usr/lib/python3.8/site-packages/daemonocle/cli.py", line 32, in __init__
    context_settings = {'obj': self.daemon_class(**self.daemon_params)}
  File "/usr/lib/python3.8/site-packages/daemonocle/core.py", line 37, in __init__
    self.detach = detach & self._is_detach_necessary()
  File "/usr/lib/python3.8/site-packages/daemonocle/core.py", line 258, in _is_detach_necessary
    if cls._is_socket(sys.stdin):
  File "/usr/lib/python3.8/site-packages/daemonocle/core.py", line 224, in _is_socket
    sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_RAW)
  File "/usr/lib/python3.8/socket.py", line 544, in fromfd
    return socket(family, type, proto, nfd)
  File "/usr/lib/python3.8/socket.py", line 231, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
OSError: [Errno 88] Socket operation on non-socket

when trying to start it.

And here is the resolution: The file /usr/lib/python3.8/site-packages/daemonocle/core.py has to be edited according to the fix described here: https://pagure.io/python-daemon/pull-request/35#request_diff

Line 224 of /usr/lib/python3.8/site-packages/daemonocle/core.py has to be moved in the subsequent try... block for Python 3.8 support like below:

        #to be moved into the try block below for Python 3.8 support:
        #sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_RAW)
        try:
            # This will raise a socket.error if it's not a socket
            sock =socket.fromfd(fd, socket.AF_INET, socket.SOCK_RAW)
            sock.getsockopt(socket.SOL_SOCKET, socket.SO_TYPE)
        except socket.error as ex:
            if ex.args[0] != errno.ENOTSOCK:
                # It must be a socket
                return True
        else:
            # If an exception wasn't raised, it's a socket
            return True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions