{"action":"created","comment":{"url":"https://api.github.com/repos/scopatz/xonsh/pulls/comments/66003872","id":66003872,"diff_hunk":"@@ -427,9 +427,20 @@ def print_exception(msg=None):\n     env = getattr(builtins, '__xonsh_env__', os.environ)\n     if 'XONSH_SHOW_TRACEBACK' not in env:\n         sys.stderr.write('xonsh: For full traceback set: '\n-                         '$XONSH_SHOW_TRACEBACK = True\\n')\n-    if env.get('XONSH_SHOW_TRACEBACK', False):\n-        traceback.print_exc()\n+                         '$XONSH_SHOW_TRACEBACK = True or '\n+                         '$XONSH_SHOW_TRACEBACK = \\'<filename>\\'\\n')\n+    # get env option for traceback and convert it to a tuple\n+    traceback_opt = env.get('XONSH_SHOW_TRACEBACK', False)\n+    show_trace, out_file = to_tb_tuple(traceback_opt)\n+    if show_trace:\n+        if not out_file:\n+            # if the user has not specified a file, output to stderr\n+            traceback.print_exc()\n+        else:\n+            # if the user has specified a file, open it in append mode\n+            # and output traceback info there, as well as to stderr\n+            traceback.print_exc()","path":"xonsh/tools.py","position":19,"original_position":19,"commit_id":"cba9660e904569d2275d22670af5b087f190ba2f","original_commit_id":"cba9660e904569d2275d22670af5b087f190ba2f","user":{"login":"adqm","id":549404,"avatar_url":"https://avatars.githubusercontent.com/u/549404?v=3","gravatar_id":"","url":"https://api.github.com/users/adqm","html_url":"https://github.com/adqm","followers_url":"https://api.github.com/users/adqm/followers","following_url":"https://api.github.com/users/adqm/following{/other_user}","gists_url":"https://api.github.com/users/adqm/gists{/gist_id}","starred_url":"https://api.github.com/users/adqm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adqm/subscriptions","organizations_url":"https://api.github.com/users/adqm/orgs","repos_url":"https://api.github.com/users/adqm/repos","events_url":"https://api.github.com/users/adqm/events{/privacy}","received_events_url":"https://api.github.com/users/adqm/received_events","type":"User","site_admin":false},"body":"I also think that if a user has specified a file as the argument, it probably means they don't want to see the whole traceback in the shell.  We could try to find a way to toggle between these behaviors, but I think it would make sense to display only the error message here, and write the full traceback to the specified file.","created_at":"2016-06-07T03:05:59Z","updated_at":"2016-06-07T03:05:59Z","html_url":"https://github.com/scopatz/xonsh/pull/1145#discussion_r66003872","pull_request_url":"https://api.github.com/repos/scopatz/xonsh/pulls/1145","_links":{"self":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/comments/66003872"},"html":{"href":"https://github.com/scopatz/xonsh/pull/1145#discussion_r66003872"},"pull_request":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/1145"}}},"pull_request":{"url":"https://api.github.com/repos/scopatz/xonsh/pulls/1145","id":72806261,"html_url":"https://github.com/scopatz/xonsh/pull/1145","diff_url":"https://github.com/scopatz/xonsh/pull/1145.diff","patch_url":"https://github.com/scopatz/xonsh/pull/1145.patch","issue_url":"https://api.github.com/repos/scopatz/xonsh/issues/1145","number":1145,"state":"open","locked":false,"title":"Added file option for XONSH_SHOW_TRACEBACK","user":{"login":"VHarisop","id":1775994,"avatar_url":"https://avatars.githubusercontent.com/u/1775994?v=3","gravatar_id":"","url":"https://api.github.com/users/VHarisop","html_url":"https://github.com/VHarisop","followers_url":"https://api.github.com/users/VHarisop/followers","following_url":"https://api.github.com/users/VHarisop/following{/other_user}","gists_url":"https://api.github.com/users/VHarisop/gists{/gist_id}","starred_url":"https://api.github.com/users/VHarisop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VHarisop/subscriptions","organizations_url":"https://api.github.com/users/VHarisop/orgs","repos_url":"https://api.github.com/users/VHarisop/repos","events_url":"https://api.github.com/users/VHarisop/events{/privacy}","received_events_url":"https://api.github.com/users/VHarisop/received_events","type":"User","site_admin":false},"body":"In response to #1025 , `$XONSH_SHOW_TRACEBACK` may now be either a `bool` or a `str`. In the former case, the traceback is logged to standard error only. In the latter case, traceback is additionally logged to a file whose path is given by the value of `$XONSH_SHOW_TRACEBACK`.","created_at":"2016-06-07T02:14:39Z","updated_at":"2016-06-07T03:05:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"215342b5e2c153b7fcbd8a7cdb8736c4a69ed4ef","assignee":null,"milestone":{"url":"https://api.github.com/repos/scopatz/xonsh/milestones/4","html_url":"https://github.com/scopatz/xonsh/milestones/v0.4.0","labels_url":"https://api.github.com/repos/scopatz/xonsh/milestones/4/labels","id":1779851,"number":4,"title":"v0.4.0","description":"","creator":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"open_issues":157,"closed_issues":89,"state":"open","created_at":"2016-05-20T22:54:44Z","updated_at":"2016-06-07T02:58:14Z","due_on":"2016-06-30T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scopatz/xonsh/pulls/1145/commits","review_comments_url":"https://api.github.com/repos/scopatz/xonsh/pulls/1145/comments","review_comment_url":"https://api.github.com/repos/scopatz/xonsh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scopatz/xonsh/issues/1145/comments","statuses_url":"https://api.github.com/repos/scopatz/xonsh/statuses/cba9660e904569d2275d22670af5b087f190ba2f","head":{"label":"VHarisop:traceback_file","ref":"traceback_file","sha":"cba9660e904569d2275d22670af5b087f190ba2f","user":{"login":"VHarisop","id":1775994,"avatar_url":"https://avatars.githubusercontent.com/u/1775994?v=3","gravatar_id":"","url":"https://api.github.com/users/VHarisop","html_url":"https://github.com/VHarisop","followers_url":"https://api.github.com/users/VHarisop/followers","following_url":"https://api.github.com/users/VHarisop/following{/other_user}","gists_url":"https://api.github.com/users/VHarisop/gists{/gist_id}","starred_url":"https://api.github.com/users/VHarisop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VHarisop/subscriptions","organizations_url":"https://api.github.com/users/VHarisop/orgs","repos_url":"https://api.github.com/users/VHarisop/repos","events_url":"https://api.github.com/users/VHarisop/events{/privacy}","received_events_url":"https://api.github.com/users/VHarisop/received_events","type":"User","site_admin":false},"repo":{"id":60440118,"name":"xonsh","full_name":"VHarisop/xonsh","owner":{"login":"VHarisop","id":1775994,"avatar_url":"https://avatars.githubusercontent.com/u/1775994?v=3","gravatar_id":"","url":"https://api.github.com/users/VHarisop","html_url":"https://github.com/VHarisop","followers_url":"https://api.github.com/users/VHarisop/followers","following_url":"https://api.github.com/users/VHarisop/following{/other_user}","gists_url":"https://api.github.com/users/VHarisop/gists{/gist_id}","starred_url":"https://api.github.com/users/VHarisop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VHarisop/subscriptions","organizations_url":"https://api.github.com/users/VHarisop/orgs","repos_url":"https://api.github.com/users/VHarisop/repos","events_url":"https://api.github.com/users/VHarisop/events{/privacy}","received_events_url":"https://api.github.com/users/VHarisop/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VHarisop/xonsh","description":"xonsh is a Python-ish, BASHwards-facing shell.","fork":true,"url":"https://api.github.com/repos/VHarisop/xonsh","forks_url":"https://api.github.com/repos/VHarisop/xonsh/forks","keys_url":"https://api.github.com/repos/VHarisop/xonsh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VHarisop/xonsh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VHarisop/xonsh/teams","hooks_url":"https://api.github.com/repos/VHarisop/xonsh/hooks","issue_events_url":"https://api.github.com/repos/VHarisop/xonsh/issues/events{/number}","events_url":"https://api.github.com/repos/VHarisop/xonsh/events","assignees_url":"https://api.github.com/repos/VHarisop/xonsh/assignees{/user}","branches_url":"https://api.github.com/repos/VHarisop/xonsh/branches{/branch}","tags_url":"https://api.github.com/repos/VHarisop/xonsh/tags","blobs_url":"https://api.github.com/repos/VHarisop/xonsh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VHarisop/xonsh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VHarisop/xonsh/git/refs{/sha}","trees_url":"https://api.github.com/repos/VHarisop/xonsh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VHarisop/xonsh/statuses/{sha}","languages_url":"https://api.github.com/repos/VHarisop/xonsh/languages","stargazers_url":"https://api.github.com/repos/VHarisop/xonsh/stargazers","contributors_url":"https://api.github.com/repos/VHarisop/xonsh/contributors","subscribers_url":"https://api.github.com/repos/VHarisop/xonsh/subscribers","subscription_url":"https://api.github.com/repos/VHarisop/xonsh/subscription","commits_url":"https://api.github.com/repos/VHarisop/xonsh/commits{/sha}","git_commits_url":"https://api.github.com/repos/VHarisop/xonsh/git/commits{/sha}","comments_url":"https://api.github.com/repos/VHarisop/xonsh/comments{/number}","issue_comment_url":"https://api.github.com/repos/VHarisop/xonsh/issues/comments{/number}","contents_url":"https://api.github.com/repos/VHarisop/xonsh/contents/{+path}","compare_url":"https://api.github.com/repos/VHarisop/xonsh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VHarisop/xonsh/merges","archive_url":"https://api.github.com/repos/VHarisop/xonsh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VHarisop/xonsh/downloads","issues_url":"https://api.github.com/repos/VHarisop/xonsh/issues{/number}","pulls_url":"https://api.github.com/repos/VHarisop/xonsh/pulls{/number}","milestones_url":"https://api.github.com/repos/VHarisop/xonsh/milestones{/number}","notifications_url":"https://api.github.com/repos/VHarisop/xonsh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VHarisop/xonsh/labels{/name}","releases_url":"https://api.github.com/repos/VHarisop/xonsh/releases{/id}","deployments_url":"https://api.github.com/repos/VHarisop/xonsh/deployments","created_at":"2016-06-05T02:45:45Z","updated_at":"2016-06-05T02:45:47Z","pushed_at":"2016-06-07T02:11:19Z","git_url":"git://github.com/VHarisop/xonsh.git","ssh_url":"git@github.com:VHarisop/xonsh.git","clone_url":"https://github.com/VHarisop/xonsh.git","svn_url":"https://github.com/VHarisop/xonsh","homepage":"http://xon.sh","size":4936,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scopatz:master","ref":"master","sha":"f35afddaa23fdc8f362805f26012fdbbe9c39659","user":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"repo":{"id":29620400,"name":"xonsh","full_name":"scopatz/xonsh","owner":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scopatz/xonsh","description":"xonsh is a Python-ish, BASHwards-facing shell.","fork":false,"url":"https://api.github.com/repos/scopatz/xonsh","forks_url":"https://api.github.com/repos/scopatz/xonsh/forks","keys_url":"https://api.github.com/repos/scopatz/xonsh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scopatz/xonsh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scopatz/xonsh/teams","hooks_url":"https://api.github.com/repos/scopatz/xonsh/hooks","issue_events_url":"https://api.github.com/repos/scopatz/xonsh/issues/events{/number}","events_url":"https://api.github.com/repos/scopatz/xonsh/events","assignees_url":"https://api.github.com/repos/scopatz/xonsh/assignees{/user}","branches_url":"https://api.github.com/repos/scopatz/xonsh/branches{/branch}","tags_url":"https://api.github.com/repos/scopatz/xonsh/tags","blobs_url":"https://api.github.com/repos/scopatz/xonsh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scopatz/xonsh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scopatz/xonsh/git/refs{/sha}","trees_url":"https://api.github.com/repos/scopatz/xonsh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scopatz/xonsh/statuses/{sha}","languages_url":"https://api.github.com/repos/scopatz/xonsh/languages","stargazers_url":"https://api.github.com/repos/scopatz/xonsh/stargazers","contributors_url":"https://api.github.com/repos/scopatz/xonsh/contributors","subscribers_url":"https://api.github.com/repos/scopatz/xonsh/subscribers","subscription_url":"https://api.github.com/repos/scopatz/xonsh/subscription","commits_url":"https://api.github.com/repos/scopatz/xonsh/commits{/sha}","git_commits_url":"https://api.github.com/repos/scopatz/xonsh/git/commits{/sha}","comments_url":"https://api.github.com/repos/scopatz/xonsh/comments{/number}","issue_comment_url":"https://api.github.com/repos/scopatz/xonsh/issues/comments{/number}","contents_url":"https://api.github.com/repos/scopatz/xonsh/contents/{+path}","compare_url":"https://api.github.com/repos/scopatz/xonsh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scopatz/xonsh/merges","archive_url":"https://api.github.com/repos/scopatz/xonsh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scopatz/xonsh/downloads","issues_url":"https://api.github.com/repos/scopatz/xonsh/issues{/number}","pulls_url":"https://api.github.com/repos/scopatz/xonsh/pulls{/number}","milestones_url":"https://api.github.com/repos/scopatz/xonsh/milestones{/number}","notifications_url":"https://api.github.com/repos/scopatz/xonsh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scopatz/xonsh/labels{/name}","releases_url":"https://api.github.com/repos/scopatz/xonsh/releases{/id}","deployments_url":"https://api.github.com/repos/scopatz/xonsh/deployments","created_at":"2015-01-21T22:05:27Z","updated_at":"2016-06-07T02:58:58Z","pushed_at":"2016-06-07T02:58:14Z","git_url":"git://github.com/scopatz/xonsh.git","ssh_url":"git@github.com:scopatz/xonsh.git","clone_url":"https://github.com/scopatz/xonsh.git","svn_url":"https://github.com/scopatz/xonsh","homepage":"http://xon.sh","size":5893,"stargazers_count":1376,"watchers_count":1376,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":132,"mirror_url":null,"open_issues_count":199,"forks":132,"open_issues":199,"watchers":1376,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/1145"},"html":{"href":"https://github.com/scopatz/xonsh/pull/1145"},"issue":{"href":"https://api.github.com/repos/scopatz/xonsh/issues/1145"},"comments":{"href":"https://api.github.com/repos/scopatz/xonsh/issues/1145/comments"},"review_comments":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/1145/comments"},"review_comment":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scopatz/xonsh/pulls/1145/commits"},"statuses":{"href":"https://api.github.com/repos/scopatz/xonsh/statuses/cba9660e904569d2275d22670af5b087f190ba2f"}}}}
{"actor":{"display_login":"adqm"}}