Skip to content

Commit

Permalink
fix petl executable
Browse files Browse the repository at this point in the history
  • Loading branch information
alimanfoo committed Jan 13, 2015
1 parent 01d0caa commit 65db70d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions bin/petl
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#!/usr/bin/env python

from __future__ import print_function, division, absolute_import
import sys
import os
import os.path
import glob
from optparse import OptionParser

from petl import VERSION
from petl.fluent import *
from petl import __version__
from petl import *

parser = OptionParser(
usage="%prog [options] expression",
description="Evaluate a Python expression. The expression will be "
"evaluated using eval(), with petl.fluent functions imported.",
version=VERSION)
"evaluated using eval(), with petl functions imported.",
version=__version__)

options, args = parser.parse_args()

Expand All @@ -24,7 +25,7 @@ except ValueError:
r = eval(expression)

if r is not None:
if isinstance(r, FluentWrapper):
print look(r)
if isinstance(r, Table):
print(look(r))
else:
print str(r)
print(str(r))
4 changes: 2 additions & 2 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ Also included in the ``petl`` distribution is a script to execute
simple transformation pipelines directly from the operating system
shell. E.g.::

$ petl "dummytable().tocsv()" > dummy.csv
$ cat dummy.csv | petl "fromcsv().cut('foo', 'baz').selectgt('baz', 0.5).head().data().totsv()"
$ petl "dummytable().tocsv()" > example.csv
$ cat example.csv | petl "fromcsv().cut('foo', 'baz').selectgt('baz', 0.5).head().data().totsv()"

The ``petl`` script is extremely simple, it expects a single
positional argument, which is evaluated as Python code but with all of
Expand Down

0 comments on commit 65db70d

Please sign in to comment.