Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60311 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2013-11-23 17:29 +0100 |
| Last post | 2013-11-23 17:29 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Using sh library with grep command Peter Otten <__peter__@web.de> - 2013-11-23 17:29 +0100
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2013-11-23 17:29 +0100 |
| Subject | Re: Using sh library with grep command |
| Message-ID | <mailman.3092.1385224149.18130.python-list@python.org> |
Luca wrote:
> 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?
Did you run grep with or without the -r option?
The code sample and the error message don't match. Maybe you accidentally
left out the -r in your actual code.
Back to top | Article view | comp.lang.python
csiph-web