I've only encountered it when something patches out sys.stdin, and is file-like enough to work, but is missing attributes such as `encoding`.  For example, our test runner will do something like:

```
original = sys.stdin
sys.stdin = cStringIO.StringIO()
try:
  ...
finally:
  sys.stdin = original
```