[Python-Dev] Runtime Error about fileinput.py

Jeff Epler jepler at unpythonic.net
Wed Aug 13 12:34:11 EDT 2003


it's not necessarily related to your problem, but it's a bad idea to
give your program the name "XXX.py" when XXX is the name of a standard
Python module.

The error message is intended to indicate that you've called
fileinput.input() before, but then you didn't consume all the lines
available.  For instance, this program shows a very similar traceback:

#!/usr/bin/python
import fileinput
x = fileinput.input("/etc/fstab")
x.readline()
y = fileinput.input("/etc/fstab")

$ python /tmp/vivian.py
Traceback (most recent call last):
  File "/tmp/vivian.py", line 5, in ?
    y = fileinput.input("/etc/fstab")
  File "/usr/lib/python2.2/fileinput.py", line 101, in input
    raise RuntimeError, "input() already active"
RuntimeError: input() already active

Jeff



More information about the Python-Dev mailing list