{"action":"created","issue":{"url":"https://api.github.com/repos/squeed/nodemcu-env/issues/1","labels_url":"https://api.github.com/repos/squeed/nodemcu-env/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/squeed/nodemcu-env/issues/1/comments","events_url":"https://api.github.com/repos/squeed/nodemcu-env/issues/1/events","html_url":"https://github.com/squeed/nodemcu-env/issues/1","id":91488864,"number":1,"title":"no response when bootstraping","user":{"login":"XenGi","id":1043980,"avatar_url":"https://avatars.githubusercontent.com/u/1043980?v=3","gravatar_id":"","url":"https://api.github.com/users/XenGi","html_url":"https://github.com/XenGi","followers_url":"https://api.github.com/users/XenGi/followers","following_url":"https://api.github.com/users/XenGi/following{/other_user}","gists_url":"https://api.github.com/users/XenGi/gists{/gist_id}","starred_url":"https://api.github.com/users/XenGi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XenGi/subscriptions","organizations_url":"https://api.github.com/users/XenGi/orgs","repos_url":"https://api.github.com/users/XenGi/repos","events_url":"https://api.github.com/users/XenGi/events{/privacy}","received_events_url":"https://api.github.com/users/XenGi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-27T16:35:15Z","updated_at":"2015-06-28T17:37:40Z","closed_at":null,"body":"Wifi setup works:\r\n\r\n```\r\n$ ./mcutool wifi --port /dev/ttyUSB0 mywifi mypass\r\nConfiguring WiFi settings via serial...\r\nSuccessfully got IP address 192.168.178.126\r\nNow load the boostrap environment with 'boostrap'\r\n```\r\n\r\nBootstraping:\r\n\r\n```\r\n$ ./mcutool -d bootstrap --port /dev/ttyUSB0\r\nFlushing serial port\r\nWRITE COMMAND: b'\\r\\n'\r\nRemoving any old files\r\nWRITE COMMAND: b'file.format(); print(\"OK\")\\r\\n'\r\nGot response: file.format(); print(\"OK\")\r\nformat done.\r\nOK\r\n> \r\nStarting fileserver\r\nWRITE COMMAND: b'ip=\"127.0.1.1\"; filename=\"init.lua\"; print(\"OK\")\\r\\n'\r\nGot response: ip=\"127.0.1.1\"; filename=\"init.lua\"; print(\"OK\")\r\nOK\r\n> \r\nDownloading file\r\nWRITE COMMAND: b'sk = net.createConnection(net.TCP, 0); file.open(filename, \"w+\"); sk:on(\"receive\", function(sck, c) file.write(c) ; end ); sk:on(\"disconnection\", function(sock, a) file.flush(); file.close(); end); sk:connect(9600, ip); print(\"OK\")\\r\\n'\r\nGot response: sk = net.createConnection(net.TCP, 0); file.open(filename, \"w+\"); sk:on(\"receive\", function(sck, c) file.write(c) ; end ); sk:on(\"disconnection\", function(sock, a) file.flush(); file.close(); end); sk:connect(9600, ip); print(\"OK\")\r\nOK\r\n> \r\n\r\n```\r\n\r\nThen it hangs and nothing happens for at least 3min. I aborted it with `Ctrl+C`. How long should this take normally?\r\nIt hangs on the line `fs.event.wait()  # Wait for the server to say that it's done`. It got the \"OK\" and the lua prompt, so it should be done and continue.\r\n\r\nI removed the `-t` in the shebang because their is no such option in the python3 interpreter and even  if I try to run it with python2 where there is such an option this shebang doesn't work and it also complains about not finding the \"socketserver\" module. So I think python3 is the way to go here.\r\nYou should change the shebang to `#!/usr/bin/env python3`. This will work on every os."},"comment":{"url":"https://api.github.com/repos/squeed/nodemcu-env/issues/comments/116303099","html_url":"https://github.com/squeed/nodemcu-env/issues/1#issuecomment-116303099","issue_url":"https://api.github.com/repos/squeed/nodemcu-env/issues/1","id":116303099,"user":{"login":"XenGi","id":1043980,"avatar_url":"https://avatars.githubusercontent.com/u/1043980?v=3","gravatar_id":"","url":"https://api.github.com/users/XenGi","html_url":"https://github.com/XenGi","followers_url":"https://api.github.com/users/XenGi/followers","following_url":"https://api.github.com/users/XenGi/following{/other_user}","gists_url":"https://api.github.com/users/XenGi/gists{/gist_id}","starred_url":"https://api.github.com/users/XenGi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XenGi/subscriptions","organizations_url":"https://api.github.com/users/XenGi/orgs","repos_url":"https://api.github.com/users/XenGi/repos","events_url":"https://api.github.com/users/XenGi/events{/privacy}","received_events_url":"https://api.github.com/users/XenGi/received_events","type":"User","site_admin":false},"created_at":"2015-06-28T17:37:40Z","updated_at":"2015-06-28T17:37:40Z","body":"The socketserver bind should be `self.socket.bind(('', port))` and `server = socketserver.UDPServer(('', BROADCAST_PORT), BroadcastListener)` to bind to INADDR_ANY.\r\n\r\nAlso the line `local_ip = socket.gethostbyname(socket.gethostname())` often returns `127.0.0.1` because many distros has this in their `/etc/hosts` file. The best way that requires no dependencies I found to get the correct address requires an internet connection but works:\r\n\r\n```\r\ndef get_ip_address():\r\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\r\n    s.connect((\"8.8.8.8\", 80))\r\n    ip = s.getsockname()[0]\r\n    s.close()\r\n    return ip\r\nlocal_ip = get_ip_address()\r\n```\r\n\r\nWith this fixes included it still hangs on the same point. I got some errors on the nodemcu with your commands, so I removed all `;` which are unnecessary in lua and it seemed to work but still no response in the python code.\r\n\r\nI will continue debugging this tomorrow."}}