{"action":"created","issue":{"url":"https://api.github.com/repos/scopatz/xonsh/issues/168","labels_url":"https://api.github.com/repos/scopatz/xonsh/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/scopatz/xonsh/issues/168/comments","events_url":"https://api.github.com/repos/scopatz/xonsh/issues/168/events","html_url":"https://github.com/scopatz/xonsh/pull/168","id":65334348,"number":168,"title":"more robust subproc injection","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},"labels":[{"url":"https://api.github.com/repos/scopatz/xonsh/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/scopatz/xonsh/milestones/1","html_url":"https://github.com/scopatz/xonsh/milestones/v0.2","labels_url":"https://api.github.com/repos/scopatz/xonsh/milestones/1/labels","id":1013181,"number":1,"title":"v0.2","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":35,"closed_issues":127,"state":"open","created_at":"2015-03-09T18:29:10Z","updated_at":"2015-03-31T00:28:09Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-03-31T00:28:09Z","updated_at":"2015-03-31T01:03:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scopatz/xonsh/pulls/168","html_url":"https://github.com/scopatz/xonsh/pull/168","diff_url":"https://github.com/scopatz/xonsh/pull/168.diff","patch_url":"https://github.com/scopatz/xonsh/pull/168.patch"},"body":"This should fix #167, and many other relevant cases."},"comment":{"url":"https://api.github.com/repos/scopatz/xonsh/issues/comments/87891020","html_url":"https://github.com/scopatz/xonsh/pull/168#issuecomment-87891020","issue_url":"https://api.github.com/repos/scopatz/xonsh/issues/168","id":87891020,"user":{"login":"wrywerytwreywery","id":549404,"avatar_url":"https://avatars.githubusercontent.com/u/549404?v=3","gravatar_id":"","url":"https://api.github.com/users/wrywerytwreywery","html_url":"https://github.com/wrywerytwreywery","followers_url":"https://api.github.com/users/wrywerytwreywery/followers","following_url":"https://api.github.com/users/wrywerytwreywery/following{/other_user}","gists_url":"https://api.github.com/users/wrywerytwreywery/gists{/gist_id}","starred_url":"https://api.github.com/users/wrywerytwreywery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wrywerytwreywery/subscriptions","organizations_url":"https://api.github.com/users/wrywerytwreywery/orgs","repos_url":"https://api.github.com/users/wrywerytwreywery/repos","events_url":"https://api.github.com/users/wrywerytwreywery/events{/privacy}","received_events_url":"https://api.github.com/users/wrywerytwreywery/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T01:03:40Z","updated_at":"2015-03-31T01:03:40Z","body":"I noticed an issue (not sure if there is any way around this).  Single-token subprocess expressions seem not to work inside scripts.  So, for example, the following works from the shell and in a script:\r\n\r\n```\r\nfor i in range(20):\r\n    cd ~/xonsh\r\n    ls .\r\n    for i in range(5):\r\n        print('howdy')\r\n```\r\n\r\nThe following works from the shell, but not in a script:\r\n```\r\nfor i in range(20):\r\n    cd ~/xonsh\r\n    ls\r\n    for i in range(5):\r\n        print('howdy')\r\n```\r\n\r\nIt fails with the following error:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/xonsh\", line 3, in <module>\r\n    main()\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/main.py\", line 53, in main\r\n    code = shell.execer.compile(code, mode='exec', glbs=shell.ctx)\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/execer.py\", line 92, in compile\r\n    code = compile(tree, self.filename, mode)\r\nTypeError: expected some sort of stmt, but got <_ast.Call object at 0x7fe242329cf8>\r\n```\r\n\r\nIn fact, just something like `ls` on one line by itself in a script seems not to work.\r\n\r\nAfter looking a little more closely, it seems that things that can parse down to valid Python give this error (so `ls -la` fails in the same way).  Interestingly, `ls ;` fails in a different way:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/xonsh\", line 3, in <module>\r\n    main()\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/main.py\", line 53, in main\r\n    code = shell.execer.compile(code, mode='exec', glbs=shell.ctx)\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/execer.py\", line 89, in compile\r\n    tree = self.parse(input, ctx, mode=mode)\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/execer.py\", line 77, in parse\r\n    tree = self.ctxtransformer.ctxvisit(tree, input, ctx, mode=mode)\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/ast.py\", line 80, in ctxvisit\r\n    node = self.visit(node)\r\n  File \"/usr/local/lib/python3.4/ast.py\", line 245, in visit\r\n    return visitor(node)\r\n  File \"/usr/local/lib/python3.4/ast.py\", line 301, in generic_visit\r\n    value = self.visit(value)\r\n  File \"/usr/local/lib/python3.4/ast.py\", line 245, in visit\r\n    return visitor(node)\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/ast.py\", line 188, in visit_For\r\n    self.generic_visit(node)\r\n  File \"/usr/local/lib/python3.4/ast.py\", line 301, in generic_visit\r\n    value = self.visit(value)\r\n  File \"/usr/local/lib/python3.4/ast.py\", line 245, in visit\r\n    return visitor(node)\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/ast.py\", line 141, in visit_Expr\r\n    return self.try_subproc_toks(node)\r\n  File \"/usr/local/lib/python3.4/site-packages/xonsh/ast.py\", line 108, in try_subproc_toks\r\n    newnode = newnode.body\r\nAttributeError: 'NoneType' object has no attribute 'body'\r\n```"}}