{"action":"created","comment":{"url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/comments/172929892","pull_request_review_id":102032857,"id":172929892,"diff_hunk":"@@ -473,7 +473,7 @@ def parse_package(path, warnings=None):\n     try:\n         return parse_package_string(xml, filename, warnings=warnings)\n     except InvalidPackage as e:\n-        e.args = ['Invalid package manifest \"%s\": %s' % (filename, e.message)]\n+        e.args = ['Invalid package manifest \"{}\": {}'.format(filename, e)]","path":"src/catkin_pkg/package.py","position":null,"original_position":5,"commit_id":"c785b675589e88d44e992dd3561c52cc30a56ae9","original_commit_id":"04d1490a6d3854c8a8cb9c235cfc2de4a3eb4cec","user":{"login":"de-vri-es","id":786213,"avatar_url":"https://avatars1.githubusercontent.com/u/786213?v=4","gravatar_id":"","url":"https://api.github.com/users/de-vri-es","html_url":"https://github.com/de-vri-es","followers_url":"https://api.github.com/users/de-vri-es/followers","following_url":"https://api.github.com/users/de-vri-es/following{/other_user}","gists_url":"https://api.github.com/users/de-vri-es/gists{/gist_id}","starred_url":"https://api.github.com/users/de-vri-es/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/de-vri-es/subscriptions","organizations_url":"https://api.github.com/users/de-vri-es/orgs","repos_url":"https://api.github.com/users/de-vri-es/repos","events_url":"https://api.github.com/users/de-vri-es/events{/privacy}","received_events_url":"https://api.github.com/users/de-vri-es/received_events","type":"User","site_admin":false},"body":"Changed to `{0}` and `{1}`, which are also python 2.6 compatible (there are more uses of `str.format()` in the same file already).","created_at":"2018-03-07T17:57:26Z","updated_at":"2018-03-07T17:57:27Z","html_url":"https://github.com/ros-infrastructure/catkin_pkg/pull/206#discussion_r172929892","pull_request_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/206","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/comments/172929892"},"html":{"href":"https://github.com/ros-infrastructure/catkin_pkg/pull/206#discussion_r172929892"},"pull_request":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/206"}},"in_reply_to_id":172905627},"pull_request":{"url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/206","id":172717320,"html_url":"https://github.com/ros-infrastructure/catkin_pkg/pull/206","diff_url":"https://github.com/ros-infrastructure/catkin_pkg/pull/206.diff","patch_url":"https://github.com/ros-infrastructure/catkin_pkg/pull/206.patch","issue_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/issues/206","number":206,"state":"open","locked":false,"title":"Extract exception message in python2/3 compatible way.","user":{"login":"de-vri-es","id":786213,"avatar_url":"https://avatars1.githubusercontent.com/u/786213?v=4","gravatar_id":"","url":"https://api.github.com/users/de-vri-es","html_url":"https://github.com/de-vri-es","followers_url":"https://api.github.com/users/de-vri-es/followers","following_url":"https://api.github.com/users/de-vri-es/following{/other_user}","gists_url":"https://api.github.com/users/de-vri-es/gists{/gist_id}","starred_url":"https://api.github.com/users/de-vri-es/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/de-vri-es/subscriptions","organizations_url":"https://api.github.com/users/de-vri-es/orgs","repos_url":"https://api.github.com/users/de-vri-es/repos","events_url":"https://api.github.com/users/de-vri-es/events{/privacy}","received_events_url":"https://api.github.com/users/de-vri-es/received_events","type":"User","site_admin":false},"body":"In python3, `Exception` has no message attribute anymore. Instead, we should just rely on `__str__()` to give the message. Note that the `message` attribute isn't documented for python2 either.\r\n\r\nI also replaced percent formatting with `str.format()` since that is now the preferred method and I noticed it is already used within the same file.\r\n\r\nTo test that this PR works as intended in python 2 and 3 I ran this script with both versions:\r\n```python\r\nclass InvalidPackage(Exception):\r\n\tpass\r\n\r\ntry:\r\n\traise InvalidPackage('lientje leerde lotje lopen langs de lange lindelaan')\r\nexcept InvalidPackage as e:\r\n\tprint('{}'.format(e))         # works in python 2 and 3\r\n\tprint('{}'.format(e.message)) # works only in python 2\r\n```\r\n\r\nThe result when running:\r\n```\r\n$ python2 ./test.py\r\nlientje leerde lotje lopen langs de lange lindelaan\r\nlientje leerde lotje lopen langs de lange lindelaan\r\n```\r\n\r\n```\r\n$ python3 ./test.py\r\nlientje leerde lotje lopen langs de lange lindelaan\r\nTraceback (most recent call last):\r\n  File \"./test.py\", line 5, in <module>\r\n    raise InvalidPackage('lientje leerde lotje lopen langs de lange lindelaan')\r\n__main__.InvalidPackage: lientje leerde lotje lopen langs de lange lindelaan\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"./test.py\", line 8, in <module>\r\n    print('{}'.format(e.message))\r\nAttributeError: 'InvalidPackage' object has no attribute 'message'\r\n```\r\n","created_at":"2018-03-04T12:33:54Z","updated_at":"2018-03-07T17:57:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15b57c0c87abddc67395e42a22fe7a5b5c93b776","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/206/commits","review_comments_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/206/comments","review_comment_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/issues/206/comments","statuses_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/statuses/c785b675589e88d44e992dd3561c52cc30a56ae9","head":{"label":"fizyr-forks:python3-exception-message","ref":"python3-exception-message","sha":"c785b675589e88d44e992dd3561c52cc30a56ae9","user":{"login":"fizyr-forks","id":21259075,"avatar_url":"https://avatars2.githubusercontent.com/u/21259075?v=4","gravatar_id":"","url":"https://api.github.com/users/fizyr-forks","html_url":"https://github.com/fizyr-forks","followers_url":"https://api.github.com/users/fizyr-forks/followers","following_url":"https://api.github.com/users/fizyr-forks/following{/other_user}","gists_url":"https://api.github.com/users/fizyr-forks/gists{/gist_id}","starred_url":"https://api.github.com/users/fizyr-forks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fizyr-forks/subscriptions","organizations_url":"https://api.github.com/users/fizyr-forks/orgs","repos_url":"https://api.github.com/users/fizyr-forks/repos","events_url":"https://api.github.com/users/fizyr-forks/events{/privacy}","received_events_url":"https://api.github.com/users/fizyr-forks/received_events","type":"Organization","site_admin":false},"repo":{"id":68112657,"name":"catkin_pkg","full_name":"fizyr-forks/catkin_pkg","owner":{"login":"fizyr-forks","id":21259075,"avatar_url":"https://avatars2.githubusercontent.com/u/21259075?v=4","gravatar_id":"","url":"https://api.github.com/users/fizyr-forks","html_url":"https://github.com/fizyr-forks","followers_url":"https://api.github.com/users/fizyr-forks/followers","following_url":"https://api.github.com/users/fizyr-forks/following{/other_user}","gists_url":"https://api.github.com/users/fizyr-forks/gists{/gist_id}","starred_url":"https://api.github.com/users/fizyr-forks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fizyr-forks/subscriptions","organizations_url":"https://api.github.com/users/fizyr-forks/orgs","repos_url":"https://api.github.com/users/fizyr-forks/repos","events_url":"https://api.github.com/users/fizyr-forks/events{/privacy}","received_events_url":"https://api.github.com/users/fizyr-forks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fizyr-forks/catkin_pkg","description":"Standalone Python library for the catkin build system.","fork":true,"url":"https://api.github.com/repos/fizyr-forks/catkin_pkg","forks_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/forks","keys_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/teams","hooks_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/hooks","issue_events_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/issues/events{/number}","events_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/events","assignees_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/assignees{/user}","branches_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/branches{/branch}","tags_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/tags","blobs_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/git/refs{/sha}","trees_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/statuses/{sha}","languages_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/languages","stargazers_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/stargazers","contributors_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/contributors","subscribers_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/subscribers","subscription_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/subscription","commits_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/commits{/sha}","git_commits_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/git/commits{/sha}","comments_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/comments{/number}","issue_comment_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/issues/comments{/number}","contents_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/contents/{+path}","compare_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/merges","archive_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/downloads","issues_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/issues{/number}","pulls_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/pulls{/number}","milestones_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/milestones{/number}","notifications_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/labels{/name}","releases_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/releases{/id}","deployments_url":"https://api.github.com/repos/fizyr-forks/catkin_pkg/deployments","created_at":"2016-09-13T13:48:54Z","updated_at":"2016-09-13T13:48:55Z","pushed_at":"2018-03-07T17:53:54Z","git_url":"git://github.com/fizyr-forks/catkin_pkg.git","ssh_url":"git@github.com:fizyr-forks/catkin_pkg.git","clone_url":"https://github.com/fizyr-forks/catkin_pkg.git","svn_url":"https://github.com/fizyr-forks/catkin_pkg","homepage":"https://github.com/ros/catkin","size":407,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ros-infrastructure:master","ref":"master","sha":"122eae0971f13a6080b72af6bb0eb52656c00bea","user":{"login":"ros-infrastructure","id":2328632,"avatar_url":"https://avatars2.githubusercontent.com/u/2328632?v=4","gravatar_id":"","url":"https://api.github.com/users/ros-infrastructure","html_url":"https://github.com/ros-infrastructure","followers_url":"https://api.github.com/users/ros-infrastructure/followers","following_url":"https://api.github.com/users/ros-infrastructure/following{/other_user}","gists_url":"https://api.github.com/users/ros-infrastructure/gists{/gist_id}","starred_url":"https://api.github.com/users/ros-infrastructure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros-infrastructure/subscriptions","organizations_url":"https://api.github.com/users/ros-infrastructure/orgs","repos_url":"https://api.github.com/users/ros-infrastructure/repos","events_url":"https://api.github.com/users/ros-infrastructure/events{/privacy}","received_events_url":"https://api.github.com/users/ros-infrastructure/received_events","type":"Organization","site_admin":false},"repo":{"id":5896564,"name":"catkin_pkg","full_name":"ros-infrastructure/catkin_pkg","owner":{"login":"ros-infrastructure","id":2328632,"avatar_url":"https://avatars2.githubusercontent.com/u/2328632?v=4","gravatar_id":"","url":"https://api.github.com/users/ros-infrastructure","html_url":"https://github.com/ros-infrastructure","followers_url":"https://api.github.com/users/ros-infrastructure/followers","following_url":"https://api.github.com/users/ros-infrastructure/following{/other_user}","gists_url":"https://api.github.com/users/ros-infrastructure/gists{/gist_id}","starred_url":"https://api.github.com/users/ros-infrastructure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros-infrastructure/subscriptions","organizations_url":"https://api.github.com/users/ros-infrastructure/orgs","repos_url":"https://api.github.com/users/ros-infrastructure/repos","events_url":"https://api.github.com/users/ros-infrastructure/events{/privacy}","received_events_url":"https://api.github.com/users/ros-infrastructure/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros-infrastructure/catkin_pkg","description":"Standalone Python library for the catkin build system.","fork":false,"url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg","forks_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/forks","keys_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/teams","hooks_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/hooks","issue_events_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/issues/events{/number}","events_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/events","assignees_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/assignees{/user}","branches_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/branches{/branch}","tags_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/tags","blobs_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/statuses/{sha}","languages_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/languages","stargazers_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/stargazers","contributors_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/contributors","subscribers_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/subscribers","subscription_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/subscription","commits_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/contents/{+path}","compare_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/merges","archive_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/downloads","issues_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/issues{/number}","pulls_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls{/number}","milestones_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/milestones{/number}","notifications_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/labels{/name}","releases_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/releases{/id}","deployments_url":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/deployments","created_at":"2012-09-21T04:03:05Z","updated_at":"2018-03-05T08:50:21Z","pushed_at":"2018-03-07T17:53:55Z","git_url":"git://github.com/ros-infrastructure/catkin_pkg.git","ssh_url":"git@github.com:ros-infrastructure/catkin_pkg.git","clone_url":"https://github.com/ros-infrastructure/catkin_pkg.git","svn_url":"https://github.com/ros-infrastructure/catkin_pkg","homepage":"https://github.com/ros/catkin","size":412,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":46,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":46,"open_issues":6,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/206"},"html":{"href":"https://github.com/ros-infrastructure/catkin_pkg/pull/206"},"issue":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/issues/206"},"comments":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/issues/206/comments"},"review_comments":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/206/comments"},"review_comment":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/pulls/206/commits"},"statuses":{"href":"https://api.github.com/repos/ros-infrastructure/catkin_pkg/statuses/c785b675589e88d44e992dd3561c52cc30a56ae9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"de-vri-es"}}