{"issue":{"title":"Error when giving input parameters to g_traj","user":{"login":"ezitoc","id":1291102,"url":"https://api.github.com/users/ezitoc","avatar_url":"https://secure.gravatar.com/avatar/23fe59e63d558ee4c763b9b0114d00b9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"23fe59e63d558ee4c763b9b0114d00b9"},"created_at":"2011-12-28T20:22:56Z","milestone":null,"state":"open","updated_at":"2011-12-29T16:50:52Z","labels":[],"id":2674410,"closed_at":null,"html_url":"https://github.com/orbeckst/GromacsWrapper/issues/7","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"I get this error message when running the command gromacs.g_traj in a python script:\r\n\r\nTraceback (most recent call last):\r\n  File \"run.py\", line 32, in <module>\r\n    gromacs.g_traj(f=MOL+\"-md.trj\", s=MOL+\"-md.tpr\", of=\"force.xvg\", noz=\"\", noy=\"\", input=(\"6\", \"q\"))\r\n  File \"/usr/local/lib/python2.7/dist-packages/GromacsWrapper-0.2.4-py2.7.egg/gromacs/core.py\", line 265, in __call__\r\n    return self.run(*args,**kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/GromacsWrapper-0.2.4-py2.7.egg/gromacs/core.py\", line 84, in run\r\n    return self._run_command(*_args, **_kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/GromacsWrapper-0.2.4-py2.7.egg/gromacs/core.py\", line 451, in _run_command\r\n    self.check_failure(result, command_string=p.command_string)\r\n  File \"/usr/local/lib/python2.7/dist-packages/GromacsWrapper-0.2.4-py2.7.egg/gromacs/core.py\", line 402, in check_failure\r\n    raise GromacsError(rc, msg)\r\ngromacs.GromacsError: [Errno 255] Gromacs tool failed\r\nCommand invocation: printf \"6\\nq\\n\" | g_traj -of force.xvg -s esfera-md.tpr -noy  -noz  -f esfera-md.trj\r\n\r\nshell returned 1\r\n\r\nThe problem arises when i run the command \"printf \"6\\nq\\n\" | g_traj -of force.xvg -s esfera-md.tpr -noy  -noz  -f esfera-md.trj\" in shell (bash), as it works as desired.","number":7,"url":"https://api.github.com/repos/orbeckst/GromacsWrapper/issues/7","comments":2,"assignee":null},"comment":{"user":{"login":"ezitoc","id":1291102,"url":"https://api.github.com/users/ezitoc","avatar_url":"https://secure.gravatar.com/avatar/23fe59e63d558ee4c763b9b0114d00b9?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"23fe59e63d558ee4c763b9b0114d00b9"},"created_at":"2011-12-29T16:50:52Z","updated_at":"2011-12-29T16:50:52Z","id":3302444,"body":"Thanks for the response,\r\n\r\nwhen i run:\r\n<pre><code>\"printf \"6\\nq\\n\" | g_traj -of force.xvg -s esfera-md.tpr -noy -noz -f esfera-md.trj</code></pre>\r\n\r\nin bash, the command works perfectly, and i don't get any command return status 1, so i supposed the problem arises when using pipelines. Recently I have been reading the documentation and found the following:\r\n\r\n<pre><code>\r\n\r\nIn order to chain different commands via pipes one must use the special\r\nPopenWithInput object (see GromacsCommand.Popen() method) instead of\r\nthe simple call described here and first construct the pipeline explicitly and then call the\r\nPopenWithInput.communicate() method.\r\nSTDOUT and PIPE are objects provided by the subprocess module. Any python stream\r\ncan be provided and manipulated. This allows for chaining of commands. Use\r\n<pre><code>from subprocess import PIPE, STDOUT</code></pre>\r\nwhen requiring these special streams (and the special boolean switches True/False cannot\r\ndo what you need.)</code></pre>\r\n\r\nAs I am new to Python i really don't know how to try this way.\r\nThanks!\r\n\r\n","url":"https://api.github.com/repos/orbeckst/GromacsWrapper/issues/comments/3302444"},"action":"created"}