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

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

Open
DAC324 opened this issue Dec 9, 2019 · 4 comments
Open

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

DAC324 opened this issue Dec 9, 2019 · 4 comments

Comments

@DAC324
Copy link

DAC324 commented Dec 9, 2019

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
@fboaventura
Copy link

@DAC324 found a workaround:

First is to remove the daemonocle==1.0.1 module

cayenne :: ~ »  pip3 uninstall daemonocle                                                                                                                                                                                                 
Found existing installation: daemonocle 1.0.1
Uninstalling daemonocle-1.0.1:
  Would remove:
    /home/frederico/.local/lib/python3.8/site-packages/daemonocle-1.0.1.dist-info/*
    /home/frederico/.local/lib/python3.8/site-packages/daemonocle/*
Proceed (y/n)? y
  Successfully uninstalled daemonocle-1.0.1

then install the fork meeshkan-daemonocle==1.0.3

cayenne :: ~ » pip3 install --user meeshkan-daemonocle
Collecting meeshkan-daemonocle
  Downloading meeshkan-daemonocle-1.0.3.tar.gz (24 kB)
Requirement already satisfied: click in ./.local/lib/python3.8/site-packages (from meeshkan-daemonocle) (7.1.1)
Requirement already satisfied: psutil in /usr/lib/python3/dist-packages (from meeshkan-daemonocle) (5.5.1)
Building wheels for collected packages: meeshkan-daemonocle
  Building wheel for meeshkan-daemonocle (setup.py) ... done
  Created wheel for meeshkan-daemonocle: filename=meeshkan_daemonocle-1.0.3-py3-none-any.whl size=17154 sha256=54f75f77b15862cbf49797b5a9599bb0da89d18b9ddc8fa15bb6e10f48018510
  Stored in directory: /home/frederico/.cache/pip/wheels/d3/1c/71/b7960614709465500f9c1313e8c272f04958e0eceb4ad0625a
Successfully built meeshkan-daemonocle
Installing collected packages: meeshkan-daemonocle
Successfully installed meeshkan-daemonocle-1.0.3

And just to check if everything is working:

cayenne :: ~ » onedrived start                                                                                                                                                                                                           Starting onedrived ... OK
cayenne :: ~ » onedrived status
onedrived -- pid: 1609712, status: sleeping, uptime: 0m, %cpu: 0.0, %mem: 0.7

@FoXiCZEk
Copy link

I had same issue. Tried to remove and install new daemonocle but onedrive-d now says can't find daemonocle. I am wrottong from mobile so when i'll be online, i'll provide output

@gr00vy
Copy link

gr00vy commented May 15, 2020

@FoXiCZEk
You have to edit 'requirements.txt' in cloned git source root and replace 'daemonocle>=1.0.1' with 'meeshkan-daemonocle>=1.0.3'
Then reinstall from this source with:
pip3 install -e .

My full procedure of reinstalling onedrived on Ubuntu 20.04 after Ubuntu's upgrade:

this is needed or otherwise installation from source will fail

pip3 install https://github.com/OneDrive/onedrive-sdk-python/archive/master.zip

then download source:

git clone https://github.com/xybu/onedrived-dev.git
cd onedrived-dev

You have to edit 'requirements.txt' in cloned git source root and replace 'daemonocle>=1.0.1' with 'meeshkan-daemonocle>=1.0.3'

then run installation from git source root:

pip3 install -e .

@jahnog
Copy link

jahnog commented Jun 21, 2020

Just wanted to confirm that only uninstalling daemonocle and installing meeshkan-daemonocle also fixes this issue in Ubuntu 20.04.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants