Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60305
| From | Luca <lucafbb@gmail.com> |
|---|---|
| Date | 2013-11-23 15:38 +0100 |
| Subject | Using sh library with grep command |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3088.1385218947.18130.python-list@python.org> (permalink) |
I'm trying to use sh (https://pypi.python.org/pypi/sh) for calling
system grep command but it's now working as expected.
An example:
import sh
sh.grep('abc', os.getcwd(), '-r')
But I get the ErrorReturnCode_1: exception, that I learned is the
normal exit code for grep command when it not found any match.
The error instance object reported that the command run is:
*** ErrorReturnCode_1:
RAN: '/usr/bin/grep abc /Users/keul/test_sh'
Obviously manually running the command I get some output and exit code 0.
Where I'm wrong?
--
-- luca
twitter: http://twitter.com/keul
linkedin: http://linkedin.com/in/lucafbb
blog: http://blog.keul.it/
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Using sh library with grep command Luca <lucafbb@gmail.com> - 2013-11-23 15:38 +0100 Re: Using sh library with grep command Roy Smith <roy@panix.com> - 2013-11-23 10:30 -0500
csiph-web