{"action":"closed","issue":{"url":"https://api.github.com/repos/pallets/flask/issues/2977","repository_url":"https://api.github.com/repos/pallets/flask","labels_url":"https://api.github.com/repos/pallets/flask/issues/2977/labels{/name}","comments_url":"https://api.github.com/repos/pallets/flask/issues/2977/comments","events_url":"https://api.github.com/repos/pallets/flask/issues/2977/events","html_url":"https://github.com/pallets/flask/issues/2977","id":375287520,"node_id":"MDU6SXNzdWUzNzUyODc1MjA=","number":2977,"title":"Serial port access problem in DEBUG mode.","user":{"login":"edouin","id":37112156,"node_id":"MDQ6VXNlcjM3MTEyMTU2","avatar_url":"https://avatars0.githubusercontent.com/u/37112156?v=4","gravatar_id":"","url":"https://api.github.com/users/edouin","html_url":"https://github.com/edouin","followers_url":"https://api.github.com/users/edouin/followers","following_url":"https://api.github.com/users/edouin/following{/other_user}","gists_url":"https://api.github.com/users/edouin/gists{/gist_id}","starred_url":"https://api.github.com/users/edouin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edouin/subscriptions","organizations_url":"https://api.github.com/users/edouin/orgs","repos_url":"https://api.github.com/users/edouin/repos","events_url":"https://api.github.com/users/edouin/events{/privacy}","received_events_url":"https://api.github.com/users/edouin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-30T02:01:18Z","updated_at":"2018-10-30T02:15:51Z","closed_at":"2018-10-30T02:15:51Z","author_association":"NONE","body":"### Expected Behavior\r\n\r\nSending commands through the serial port.\r\n\r\n```python\r\napp = Flask(__name__)\r\nserialPort = serial.Serial(port = \"COM5\", baudrate=1000000,\r\n                           bytesize=8, timeout=2, stopbits=serial.STOPBITS_ONE)\r\n\r\nlamp = {\r\n   1 : {'name' : 'n1', 'state' : True},\r\n   2 : {'name' : 'n2', 'state' : True} \r\n}\r\n\r\n@app.route(\"/\")\r\ndef hello():\r\n   templateData = {\r\n      'lamp': lamp\r\n      }\r\n\r\n   \r\n   return render_template('main.html', **templateData)\r\n\r\n\r\n@app.route(\"/setPin/<action>\")\r\ndef action(action):\r\n\r\n   if action == \"on\":\r\n\r\n      serialPort.write(b\"n2c1111\\r\\n\")\r\n      lamp[1][\"state\"] = True\r\n\r\n   if action == \"off\":\r\n      serialPort.write(b\"n2c0000\\r\\n\")\r\n      lamp[1][\"state\"] = False\r\n\r\n\r\n   templateData = {\r\n      'lamp': lamp\r\n   }\r\n\r\n   return render_template('main.html', **templateData)\r\n\r\nif __name__ == \"__main__\":\r\n   app.run(host='0.0.0.0', port=5000, debug=True)\r\n```\r\n\r\n\r\n### Actual Behavior\r\n\r\nI can not access the serial port with  FLASK_ENV = development and FLASK_DEBUG = 1. Everything works fine with DEBUG mode disabled.\r\n\r\n```pytb\r\nFLASK_APP = app.py\r\nFLASK_ENV = development\r\nFLASK_DEBUG = 1\r\nIn folder C:/Users/user/PycharmProjects/Ho_server\r\nC:\\Users\\user\\Anaconda3\\python.exe -m flask run\r\n * Serving Flask app \"app.py\" (lazy loading)\r\n * Environment: development\r\n * Debug mode: on\r\n * Restarting with stat\r\n * Debugger is active!\r\n * Debugger PIN: 138-068-963\r\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\r\n127.0.0.1 - - [30/Oct/2018 10:49:27] \"GET /setPin/on HTTP/1.1\" 500 -\r\nTraceback (most recent call last):\r\n  File \"C:\\Users\\user\\Anaconda3\\lib\\site-packages\\flask\\_compat.py\", line 35, in reraise\r\n    raise value\r\n  File \"C:\\Users\\user\\PycharmProjects\\H_server\\app.py\", line 8, in <module>\r\n    bytesize=8, timeout=2, stopbits=serial.STOPBITS_ONE)\r\n  File \"C:\\Users\\user\\Anaconda3\\lib\\site-packages\\serial\\serialwin32.py\", line 31, in __init__\r\n    super(Serial, self).__init__(*args, **kwargs)\r\n  File \"C:\\Users\\user\\Anaconda3\\lib\\site-packages\\serial\\serialutil.py\", line 240, in __init__\r\n    self.open()\r\n  File \"C:\\Users\\user\\Anaconda3\\lib\\site-packages\\serial\\serialwin32.py\", line 62, in open\r\n    raise SerialException(\"could not open port {!r}: {!r}\".format(self.portstr, ctypes.WinError()))\r\nserial.serialutil.SerialException: could not open port 'COM5': PermissionError(13, 'Access is denied.', None, 5)\r\n```\r\n\r\n### Environment\r\n\r\n* Python version: 3.6.5\r\n* Flask version: 1.0.2\r\n"}}
{"actor":{"display_login":"davidism"}}