{"action":"created","comment":{"url":"https://api.github.com/repos/intel/bmap-tools/pulls/comments/183335087","pull_request_review_id":114312050,"id":183335087,"diff_hunk":"@@ -327,7 +327,7 @@ def find_and_open_bmap(args):\n \n     try:\n         # Create a temporary file for the bmap\n-        tmp_obj = tempfile.NamedTemporaryFile(\"w+\")\n+        tmp_obj = tempfile.NamedTemporaryFile(\"wb+\")","path":"bmaptools/CLI.py","position":14,"original_position":14,"commit_id":"2427df42657d89b0188cf1a2ddc3f63e265f1db6","original_commit_id":"2427df42657d89b0188cf1a2ddc3f63e265f1db6","user":{"login":"smcv","id":1561141,"avatar_url":"https://avatars1.githubusercontent.com/u/1561141?v=4","gravatar_id":"","url":"https://api.github.com/users/smcv","html_url":"https://github.com/smcv","followers_url":"https://api.github.com/users/smcv/followers","following_url":"https://api.github.com/users/smcv/following{/other_user}","gists_url":"https://api.github.com/users/smcv/gists{/gist_id}","starred_url":"https://api.github.com/users/smcv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smcv/subscriptions","organizations_url":"https://api.github.com/users/smcv/orgs","repos_url":"https://api.github.com/users/smcv/repos","events_url":"https://api.github.com/users/smcv/events{/privacy}","received_events_url":"https://api.github.com/users/smcv/received_events","type":"User","site_admin":false},"body":"This seems correct","created_at":"2018-04-23T09:50:18Z","updated_at":"2018-04-23T09:58:16Z","html_url":"https://github.com/intel/bmap-tools/pull/42#discussion_r183335087","pull_request_url":"https://api.github.com/repos/intel/bmap-tools/pulls/42","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/intel/bmap-tools/pulls/comments/183335087"},"html":{"href":"https://github.com/intel/bmap-tools/pull/42#discussion_r183335087"},"pull_request":{"href":"https://api.github.com/repos/intel/bmap-tools/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/intel/bmap-tools/pulls/42","id":183345179,"html_url":"https://github.com/intel/bmap-tools/pull/42","diff_url":"https://github.com/intel/bmap-tools/pull/42.diff","patch_url":"https://github.com/intel/bmap-tools/pull/42.patch","issue_url":"https://api.github.com/repos/intel/bmap-tools/issues/42","number":42,"state":"open","locked":false,"title":"python3: Fails to copy images from urls","user":{"login":"ribalda","id":562331,"avatar_url":"https://avatars3.githubusercontent.com/u/562331?v=4","gravatar_id":"","url":"https://api.github.com/users/ribalda","html_url":"https://github.com/ribalda","followers_url":"https://api.github.com/users/ribalda/followers","following_url":"https://api.github.com/users/ribalda/following{/other_user}","gists_url":"https://api.github.com/users/ribalda/gists{/gist_id}","starred_url":"https://api.github.com/users/ribalda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ribalda/subscriptions","organizations_url":"https://api.github.com/users/ribalda/orgs","repos_url":"https://api.github.com/users/ribalda/repos","events_url":"https://api.github.com/users/ribalda/events{/privacy}","received_events_url":"https://api.github.com/users/ribalda/received_events","type":"User","site_admin":false},"body":"Trying to create an image from an url results in the following errors:\r\n\r\n-With bmap\r\n```\r\nsudo bmaptool copy  http://****.com/qtec/europa/images/qt5022/qimage-dev-qt5022.wic  /dev/sdb\r\nbmaptool: info: discovered bmap file 'http://tftp.qtec.com/qtec/europa/images/qt5022/qimage-dev-qt5022.wic.bmap'\r\nTraceback (most recent call last):\r\n  File \"/usr/bin/bmaptool\", line 11, in <module>\r\n    sys.exit(main())\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/CLI.py\", line 715, in main\r\n    args.func(args)\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/CLI.py\", line 423, in copy_command\r\n    open_files(args)\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/CLI.py\", line 365, in open_files\r\n    (bmap_obj, bmap_path) = find_and_open_bmap(args)\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/CLI.py\", line 335, in find_and_open_bmap\r\n    shutil.copyfileobj(bmap_obj, tmp_obj)\r\n  File \"/usr/lib/python3.6/shutil.py\", line 82, in copyfileobj\r\n    fdst.write(buf)\r\n  File \"/usr/lib/python3.6/tempfile.py\", line 622, in func_wrapper\r\n    return func(*args, **kwargs)\r\nTypeError: write() argument must be str, not bytes\r\n\r\n```\r\n\r\n-Without bmap:\r\n\r\n```\r\nsudo bmaptool copy --nobmap  http://***.com/qtec/europa/images/qt5022/qimage-dev-qt5022.wic  /dev/sdb\r\nbmaptool: WARNING: \"/dev/sdb\" is under \"/dev\", but it is a regular file, not a device node\r\nbmaptool: info: no bmap given, copy entire image to '/dev/sdb'\r\nTraceback (most recent call last):\r\n  File \"/usr/bin/bmaptool\", line 11, in <module>\r\n    sys.exit(main())\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/CLI.py\", line 715, in main\r\n    args.func(args)\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/CLI.py\", line 477, in copy_command\r\n    writer.copy(False, not args.no_verify)\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/BmapCopy.py\", line 584, in copy\r\n    raise exc_info[1].with_traceback(exc_info[2])\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/BmapCopy.py\", line 503, in _get_data\r\n    self._f_image.seek(first * self.block_size)\r\n  File \"/usr/lib/python3/dist-packages/bmaptools/TransRead.py\", line 587, in seek\r\n    self._f_objs[-1].seek(offset, whence)\r\nio.UnsupportedOperation: seek\r\n\r\n```\r\n\r\nThis patch fixes both issues for python3. Tested with debian-9\r\n\r\nSigned-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>","created_at":"2018-04-23T07:19:15Z","updated_at":"2018-04-23T09:58:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7468938722b7352d429c6c7b4dc79ba9385e67d9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/intel/bmap-tools/pulls/42/commits","review_comments_url":"https://api.github.com/repos/intel/bmap-tools/pulls/42/comments","review_comment_url":"https://api.github.com/repos/intel/bmap-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/intel/bmap-tools/issues/42/comments","statuses_url":"https://api.github.com/repos/intel/bmap-tools/statuses/2427df42657d89b0188cf1a2ddc3f63e265f1db6","head":{"label":"ribalda:master","ref":"master","sha":"2427df42657d89b0188cf1a2ddc3f63e265f1db6","user":{"login":"ribalda","id":562331,"avatar_url":"https://avatars3.githubusercontent.com/u/562331?v=4","gravatar_id":"","url":"https://api.github.com/users/ribalda","html_url":"https://github.com/ribalda","followers_url":"https://api.github.com/users/ribalda/followers","following_url":"https://api.github.com/users/ribalda/following{/other_user}","gists_url":"https://api.github.com/users/ribalda/gists{/gist_id}","starred_url":"https://api.github.com/users/ribalda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ribalda/subscriptions","organizations_url":"https://api.github.com/users/ribalda/orgs","repos_url":"https://api.github.com/users/ribalda/repos","events_url":"https://api.github.com/users/ribalda/events{/privacy}","received_events_url":"https://api.github.com/users/ribalda/received_events","type":"User","site_admin":false},"repo":{"id":130655633,"name":"bmap-tools","full_name":"ribalda/bmap-tools","owner":{"login":"ribalda","id":562331,"avatar_url":"https://avatars3.githubusercontent.com/u/562331?v=4","gravatar_id":"","url":"https://api.github.com/users/ribalda","html_url":"https://github.com/ribalda","followers_url":"https://api.github.com/users/ribalda/followers","following_url":"https://api.github.com/users/ribalda/following{/other_user}","gists_url":"https://api.github.com/users/ribalda/gists{/gist_id}","starred_url":"https://api.github.com/users/ribalda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ribalda/subscriptions","organizations_url":"https://api.github.com/users/ribalda/orgs","repos_url":"https://api.github.com/users/ribalda/repos","events_url":"https://api.github.com/users/ribalda/events{/privacy}","received_events_url":"https://api.github.com/users/ribalda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ribalda/bmap-tools","description":"BMAP Tools","fork":true,"url":"https://api.github.com/repos/ribalda/bmap-tools","forks_url":"https://api.github.com/repos/ribalda/bmap-tools/forks","keys_url":"https://api.github.com/repos/ribalda/bmap-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ribalda/bmap-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ribalda/bmap-tools/teams","hooks_url":"https://api.github.com/repos/ribalda/bmap-tools/hooks","issue_events_url":"https://api.github.com/repos/ribalda/bmap-tools/issues/events{/number}","events_url":"https://api.github.com/repos/ribalda/bmap-tools/events","assignees_url":"https://api.github.com/repos/ribalda/bmap-tools/assignees{/user}","branches_url":"https://api.github.com/repos/ribalda/bmap-tools/branches{/branch}","tags_url":"https://api.github.com/repos/ribalda/bmap-tools/tags","blobs_url":"https://api.github.com/repos/ribalda/bmap-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ribalda/bmap-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ribalda/bmap-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/ribalda/bmap-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ribalda/bmap-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/ribalda/bmap-tools/languages","stargazers_url":"https://api.github.com/repos/ribalda/bmap-tools/stargazers","contributors_url":"https://api.github.com/repos/ribalda/bmap-tools/contributors","subscribers_url":"https://api.github.com/repos/ribalda/bmap-tools/subscribers","subscription_url":"https://api.github.com/repos/ribalda/bmap-tools/subscription","commits_url":"https://api.github.com/repos/ribalda/bmap-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/ribalda/bmap-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/ribalda/bmap-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/ribalda/bmap-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/ribalda/bmap-tools/contents/{+path}","compare_url":"https://api.github.com/repos/ribalda/bmap-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ribalda/bmap-tools/merges","archive_url":"https://api.github.com/repos/ribalda/bmap-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ribalda/bmap-tools/downloads","issues_url":"https://api.github.com/repos/ribalda/bmap-tools/issues{/number}","pulls_url":"https://api.github.com/repos/ribalda/bmap-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/ribalda/bmap-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/ribalda/bmap-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ribalda/bmap-tools/labels{/name}","releases_url":"https://api.github.com/repos/ribalda/bmap-tools/releases{/id}","deployments_url":"https://api.github.com/repos/ribalda/bmap-tools/deployments","created_at":"2018-04-23T07:17:40Z","updated_at":"2018-04-23T07:19:02Z","pushed_at":"2018-04-23T07:19:00Z","git_url":"git://github.com/ribalda/bmap-tools.git","ssh_url":"git@github.com:ribalda/bmap-tools.git","clone_url":"https://github.com/ribalda/bmap-tools.git","svn_url":"https://github.com/ribalda/bmap-tools","homepage":null,"size":512,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"intel:master","ref":"master","sha":"ee594030ff34cb76570889713860fafc77211fa9","user":{"login":"intel","id":17888862,"avatar_url":"https://avatars3.githubusercontent.com/u/17888862?v=4","gravatar_id":"","url":"https://api.github.com/users/intel","html_url":"https://github.com/intel","followers_url":"https://api.github.com/users/intel/followers","following_url":"https://api.github.com/users/intel/following{/other_user}","gists_url":"https://api.github.com/users/intel/gists{/gist_id}","starred_url":"https://api.github.com/users/intel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/intel/subscriptions","organizations_url":"https://api.github.com/users/intel/orgs","repos_url":"https://api.github.com/users/intel/repos","events_url":"https://api.github.com/users/intel/events{/privacy}","received_events_url":"https://api.github.com/users/intel/received_events","type":"Organization","site_admin":false},"repo":{"id":55086749,"name":"bmap-tools","full_name":"intel/bmap-tools","owner":{"login":"intel","id":17888862,"avatar_url":"https://avatars3.githubusercontent.com/u/17888862?v=4","gravatar_id":"","url":"https://api.github.com/users/intel","html_url":"https://github.com/intel","followers_url":"https://api.github.com/users/intel/followers","following_url":"https://api.github.com/users/intel/following{/other_user}","gists_url":"https://api.github.com/users/intel/gists{/gist_id}","starred_url":"https://api.github.com/users/intel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/intel/subscriptions","organizations_url":"https://api.github.com/users/intel/orgs","repos_url":"https://api.github.com/users/intel/repos","events_url":"https://api.github.com/users/intel/events{/privacy}","received_events_url":"https://api.github.com/users/intel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/intel/bmap-tools","description":"BMAP Tools","fork":false,"url":"https://api.github.com/repos/intel/bmap-tools","forks_url":"https://api.github.com/repos/intel/bmap-tools/forks","keys_url":"https://api.github.com/repos/intel/bmap-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/intel/bmap-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/intel/bmap-tools/teams","hooks_url":"https://api.github.com/repos/intel/bmap-tools/hooks","issue_events_url":"https://api.github.com/repos/intel/bmap-tools/issues/events{/number}","events_url":"https://api.github.com/repos/intel/bmap-tools/events","assignees_url":"https://api.github.com/repos/intel/bmap-tools/assignees{/user}","branches_url":"https://api.github.com/repos/intel/bmap-tools/branches{/branch}","tags_url":"https://api.github.com/repos/intel/bmap-tools/tags","blobs_url":"https://api.github.com/repos/intel/bmap-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/intel/bmap-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/intel/bmap-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/intel/bmap-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/intel/bmap-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/intel/bmap-tools/languages","stargazers_url":"https://api.github.com/repos/intel/bmap-tools/stargazers","contributors_url":"https://api.github.com/repos/intel/bmap-tools/contributors","subscribers_url":"https://api.github.com/repos/intel/bmap-tools/subscribers","subscription_url":"https://api.github.com/repos/intel/bmap-tools/subscription","commits_url":"https://api.github.com/repos/intel/bmap-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/intel/bmap-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/intel/bmap-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/intel/bmap-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/intel/bmap-tools/contents/{+path}","compare_url":"https://api.github.com/repos/intel/bmap-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/intel/bmap-tools/merges","archive_url":"https://api.github.com/repos/intel/bmap-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/intel/bmap-tools/downloads","issues_url":"https://api.github.com/repos/intel/bmap-tools/issues{/number}","pulls_url":"https://api.github.com/repos/intel/bmap-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/intel/bmap-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/intel/bmap-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/intel/bmap-tools/labels{/name}","releases_url":"https://api.github.com/repos/intel/bmap-tools/releases{/id}","deployments_url":"https://api.github.com/repos/intel/bmap-tools/deployments","created_at":"2016-03-30T18:23:17Z","updated_at":"2018-04-23T07:36:58Z","pushed_at":"2018-04-23T07:36:57Z","git_url":"git://github.com/intel/bmap-tools.git","ssh_url":"git@github.com:intel/bmap-tools.git","clone_url":"https://github.com/intel/bmap-tools.git","svn_url":"https://github.com/intel/bmap-tools","homepage":null,"size":513,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":10,"open_issues":11,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/intel/bmap-tools/pulls/42"},"html":{"href":"https://github.com/intel/bmap-tools/pull/42"},"issue":{"href":"https://api.github.com/repos/intel/bmap-tools/issues/42"},"comments":{"href":"https://api.github.com/repos/intel/bmap-tools/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/intel/bmap-tools/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/intel/bmap-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/intel/bmap-tools/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/intel/bmap-tools/statuses/2427df42657d89b0188cf1a2ddc3f63e265f1db6"}},"author_association":"NONE"}}
{"actor":{"display_login":"smcv"}}