opened
schmir
username_0
When calling zimports with /dev/stdin as input file, zimports 0.2.1 crashes with OSError: [Errno 29] Illegal seek
This is a regression from 0.2.0. 

```
ralf@triton ~/t % cat zimports.py|zimports --stdout /dev/stdin
Traceback (most recent call last):
  File "/home/ralf/.local/bin/zimports", line 8, in <module>
    sys.exit(main())
  File "/home/ralf/.local/pipx/venvs/zimports/lib64/python3.8/site-packages/zimports.py", line 766, in main
    _run_file(options, filename)
  File "/home/ralf/.local/pipx/venvs/zimports/lib64/python3.8/site-packages/zimports.py", line 622, in _run_file
    lines, encoding_comment = _read_python_source(filename)
  File "/home/ralf/.local/pipx/venvs/zimports/lib64/python3.8/site-packages/zimports.py", line 558, in _read_python_source
    encoding_comment = _parse_magic_encoding_comment(file_)
  File "/home/ralf/.local/pipx/venvs/zimports/lib64/python3.8/site-packages/zimports.py", line 581, in _parse_magic_encoding_comment
    pos = fp.tell()
OSError: [Errno 29] Illegal seek
```

I'm using this in my [zimports.el emacs package](https://github.com/username_0/zimports.el)
zimports cannot read from /dev/stdin anymore
issue
created
zzzeek
username_1
OK this one, was not a thing I knew you could even do.   i guess, I have to put whatever python io.Buffered thing aroudn the file handle.
comment
created
zzzeek
username_1
OK it would help if you could check my work on this one, then I can release 0.2.2.   I don't see any obvious way of unit testing this one without pulling out a whole bunch of IO mechanics.   feel free to propose writing some kind of test here but otherwise just make sure on your end it works and I'll just comment the code why it's needed.
comment
closed
zzzeek
username_1
issue
created
schmir
username_0
That fix works for me. I've opened PR #18 as an enhancement for this one. It makes 'zimports -' read from stdin and write to stdout.
Using '-' as a filename is more or less a standard way on unix to read input from stdin (e.g. /usr/bin/cat supports it)
comment