{"action":"created","issue":{"url":"https://api.github.com/repos/odoo/odoo/issues/9524","labels_url":"https://api.github.com/repos/odoo/odoo/issues/9524/labels{/name}","comments_url":"https://api.github.com/repos/odoo/odoo/issues/9524/comments","events_url":"https://api.github.com/repos/odoo/odoo/issues/9524/events","html_url":"https://github.com/odoo/odoo/issues/9524","id":116221794,"number":9524,"title":"OSError: [Errno 9] Bad file descriptor with Werkzeug 0.11","user":{"login":"patjones80","id":6819843,"avatar_url":"https://avatars.githubusercontent.com/u/6819843?v=3","gravatar_id":"","url":"https://api.github.com/users/patjones80","html_url":"https://github.com/patjones80","followers_url":"https://api.github.com/users/patjones80/followers","following_url":"https://api.github.com/users/patjones80/following{/other_user}","gists_url":"https://api.github.com/users/patjones80/gists{/gist_id}","starred_url":"https://api.github.com/users/patjones80/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patjones80/subscriptions","organizations_url":"https://api.github.com/users/patjones80/orgs","repos_url":"https://api.github.com/users/patjones80/repos","events_url":"https://api.github.com/users/patjones80/events{/privacy}","received_events_url":"https://api.github.com/users/patjones80/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-10T22:58:20Z","updated_at":"2015-11-11T05:53:41Z","closed_at":null,"body":"Hello all. I'm using Werkzeug 0.11 as part of a Flask 0.10.1 installation with Python 3.4 on Windows 8.1, and getting the following traceback upon attempting to run my code:\r\n\r\nTraceback (most recent call last):\r\n  File \"run.py\", line 6, in <module>\r\n    app.run(debug = True)\r\n  File \"c:\\Python34\\atweather\\flask\\lib\\site-packages\\flask\\app.py\", line 772, in run\r\n    run_simple(host, port, self, **options)\r\n  File \"c:\\Python34\\atweather\\flask\\lib\\site-packages\\werkzeug\\serving.py\", line 666, in run_simple\r\n    os.set_inheritable(s.fileno(), True)\r\nOSError: [Errno 9] Bad file descriptor\r\n\r\nMy website is very simple and I'm just attempting to run it locally to do some development on it. I'm fairly new to using Flask and web programming in general, so if this seems more like something that I'm doing wrong with my Flask environment, directory structure, etc. then I apologize.\r\n\r\nThanks so much in advance. "},"comment":{"url":"https://api.github.com/repos/odoo/odoo/issues/comments/155674908","html_url":"https://github.com/odoo/odoo/issues/9524#issuecomment-155674908","issue_url":"https://api.github.com/repos/odoo/odoo/issues/9524","id":155674908,"user":{"login":"elmiguel","id":3842455,"avatar_url":"https://avatars.githubusercontent.com/u/3842455?v=3","gravatar_id":"","url":"https://api.github.com/users/elmiguel","html_url":"https://github.com/elmiguel","followers_url":"https://api.github.com/users/elmiguel/followers","following_url":"https://api.github.com/users/elmiguel/following{/other_user}","gists_url":"https://api.github.com/users/elmiguel/gists{/gist_id}","starred_url":"https://api.github.com/users/elmiguel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elmiguel/subscriptions","organizations_url":"https://api.github.com/users/elmiguel/orgs","repos_url":"https://api.github.com/users/elmiguel/repos","events_url":"https://api.github.com/users/elmiguel/events{/privacy}","received_events_url":"https://api.github.com/users/elmiguel/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T05:53:41Z","updated_at":"2015-11-11T05:53:41Z","body":"Changing the code to:\r\n```python\r\n            if hasattr(os, 'set_inheritable'):\r\n                try:\r\n                    os.set_inheritable(s.fileno(), True)\r\n                except OSError:\r\n                    from pprint import pprint\r\n                    pprint(s)\r\n```\r\nallows me to see that the object is set as such:\r\n\r\n<socket.socket fd=352, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 5000)>\r\n\r\nBut when I print out the s.fileno() it prints out 376\r\n\r\nSo changing it manually:\r\n\r\n```python\r\n            if hasattr(os, 'set_inheritable'):\r\n                try:\r\n                    # os.set_inheritable(s.fileno(), True)\r\n                    os.set_inheritable(376, True)\r\n                except OSError:\r\n                    from pprint import pprint\r\n                    pprint(s.fileno())\r\n```\r\nAllows me to bypass the initial error but continues to provide another error:\r\n\r\n```python\r\n  File \"C:\\Users\\elmiguel\\flask\\lib\\site-packages\\flask\\app.py\", line 772, in run\r\n    run_simple(host, port, self, **options)\r\n  File \"C:\\Users\\elmiguel\\flask\\lib\\site-packages\\werkzeug\\serving.py\", line 633, in run_simple\r\n    application = DebuggedApplication(application, use_evalex)\r\n  File \"C:\\Users\\elmiguel\\flask\\lib\\site-packages\\werkzeug\\debug\\__init__.py\", line 169, in __init__\r\n    if self.pin is None:\r\n  File \"C:\\Users\\elmiguel\\flask\\lib\\site-packages\\werkzeug\\debug\\__init__.py\", line 179, in _get_pin\r\n    self._pin, self._pin_cookie = get_pin_and_cookie_name(self.app)\r\n  File \"C:\\Users\\elmiguel\\flask\\lib\\site-packages\\werkzeug\\debug\\__init__.py\", line 96, in get_pin_and_cookie_name\r\n    h.update('cookiesalt')\r\nTypeError: Unicode-objects must be encoded before hashing\r\n```\r\n\r\nSo changing  \r\n\r\nh.update('cookiesalt')\r\n\r\nto \r\n\r\nh.update(b'cookiesalt')\r\n\r\n\r\nreturns:\r\n```python\r\nTraceback (most recent call last):\r\n  File \"C:\\Python34\\lib\\threading.py\", line 920, in _bootstrap_inner\r\n    self.run()\r\n  File \"C:\\Python34\\lib\\threading.py\", line 868, in run\r\n    self._target(*self._args, **self._kwargs)\r\n  File \"C:\\Users\\elmiguel\\flask\\lib\\site-packages\\werkzeug\\serving.py\", line 646, in inner\r\n    fd=fd).serve_forever()\r\n  File \"C:\\Users\\elmiguel\\flask\\lib\\site-packages\\werkzeug\\serving.py\", line 550, in make_server\r\n    passthrough_errors, ssl_context, fd=fd)\r\n  File \"C:\\Users\\elmiguel\\flask\\lib\\site-packages\\werkzeug\\serving.py\", line 458, in __init__\r\n    socket.SOCK_STREAM)\r\n  File \"C:\\Python34\\lib\\socket.py\", line 295, in fromfd\r\n    nfd = dup(fd)\r\nOSError: [WinError 10038] An operation was attempted on something that is not a socket\r\n```\r\n\r\n\r\nSeems like the socket is being closed somewhere along the line before it is even being used fully."}}