popen strangeness

knotwell at my-deja.com knotwell at my-deja.com
Thu Jul 20 23:04:41 EDT 2000


Hello all--

FreeBSD3.X and Python1.5.2.  Anyone have a good idea why I'm getting
the following strangeness (the interpreter session is in order):

bash-2.03$ python
Python 1.5.2 (#5, Jul 20 2000, 21:24:46)  [GCC 2.7.2.3] on freebsd3
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import os;os.popen('ls').readlines()
['addrlist\012', 'bonfire\012', 'bonfire~\012', 'env.reg\012',
'env.reg~\012', 'ftpit.py\012', 'longevity\012', 'longevity~\012',
'tet_captured\012', 'tet_xres\012']
>>> execfile('longevity')
: could not open results code file; using default in library
cmd issue start
create local pipe
exceptions.TypeError
too many arguments; expected 1, got 2
<frame object at 813bc00>
<frame object at 8126c00>
None
-3
102
None
-3
102
None
>>> os.popen('ls').readlines()
Traceback (innermost last):
  File "/usr/local/lib/python1.5/exceptions.py", line 102, in __init__
    def __init__(self, *args):
TypeError: too many arguments; expected 1, got 2
>>> z = os.popen('ls')
>>> z
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: too many arguments; expected 1, got 2
>>> z.readlines()
['addrlist\012', 'bonfire\012', 'bonfire~\012', 'env.reg\012',
'env.reg~\012', 'ftpit.py\012', 'longevity\012', 'longevity~\012',
'tet_captured\012', 'tet_xres\012']
>>>

As far as I can tell, z is playing a I am gone. . .I am here game.  I
don't really understand why.  I've looked at this for awhile and I don't
think I'm doing something like os.popen = junkvar.

Any ideas.

--Brad


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list