{"action":"opened","issue":{"url":"https://api.github.com/repos/seb-m/pyinotify/issues/140","repository_url":"https://api.github.com/repos/seb-m/pyinotify","labels_url":"https://api.github.com/repos/seb-m/pyinotify/issues/140/labels{/name}","comments_url":"https://api.github.com/repos/seb-m/pyinotify/issues/140/comments","events_url":"https://api.github.com/repos/seb-m/pyinotify/issues/140/events","html_url":"https://github.com/seb-m/pyinotify/issues/140","id":218215678,"number":140,"title":"unhappy interaction with python-daemon","user":{"login":"JKDingwall","id":1579636,"avatar_url":"https://avatars2.githubusercontent.com/u/1579636?v=3","gravatar_id":"","url":"https://api.github.com/users/JKDingwall","html_url":"https://github.com/JKDingwall","followers_url":"https://api.github.com/users/JKDingwall/followers","following_url":"https://api.github.com/users/JKDingwall/following{/other_user}","gists_url":"https://api.github.com/users/JKDingwall/gists{/gist_id}","starred_url":"https://api.github.com/users/JKDingwall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JKDingwall/subscriptions","organizations_url":"https://api.github.com/users/JKDingwall/orgs","repos_url":"https://api.github.com/users/JKDingwall/repos","events_url":"https://api.github.com/users/JKDingwall/events{/privacy}","received_events_url":"https://api.github.com/users/JKDingwall/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-30T14:26:27Z","updated_at":"2017-03-30T14:26:27Z","closed_at":null,"body":"I have been writing a program which uses python-daemon and pyinotify but had been experiencing some problems with the inotify socket getting closed.  This fd seems to get opened as soon as the import of pyinotify is processed:\r\n\r\n```\r\n>>> import os\r\n>>> os.listdir(\"/proc/self/fd\")\r\n['0', '1', '2', '3']\r\n>>> import pyinotify\r\n>>> os.listdir(\"/proc/self/fd\")\r\n['0', '1', '2', '3', '7']\r\n```\r\n\r\nThe default behaviour of python-daemon is to close any file descriptors not marked for being preserved by being present in its context files_preserve list.  I couldn't find a way to get the fd nicely so in the end I had to do:\r\n```\r\nfiles_preserve.extend([int(x) for x in os.listdir(\"/proc/self/fd\")])\r\n```\r\nI don't know if a change in pyinotify is necessary but it seems worth making a note since this stumped me for a couple of days."}}
{"actor":{"display_login":"JKDingwall"}}