I am using these commands to convert some files in inkscape:
python dxf_input.py sample.dxf > output_ink.svg
python scour.inkscape.py output_ink.svg > output.svg
This method works prefectly fine. However, I do not want to have to create the file "output_ink.svg". Instead, I'd like to pipe this file to the second command.
I have tried a bunch of things.
using xargs:
python dxf_input.py sample.dxf | xargs python scour.inkscape.py > output.svg
scour.inkscape.py: error: no such option: -3
python dxf_input.py sample.dxf | xargs -I{} python scour.inkscape.py {} > output.svg
xargs: argument line too long
using FIFO:
python scour.inkscape.py <(>(python dxf_input.py sample.dxf))
xml.parsers.expat.ExpatError: no element found: line 1, column 0
using regular pipe:
python dxf_input.py sample.dxf | python scour.inkscape.py > output.svg
IOError: [Errno 32] Broken pipe
Nothing has worked so far.
Not all programs can accept input from any kind of a FIFO -- be that a regular pipe, a named pipe, a /dev/fd/NN
descriptor (as created by <()
on platforms where this is permissible), etc -- because FIFOs are inherently non-seekable: You can't go back to the beginning and reread prior contents as you could with a regular file; you can't skip directly ahead to a different part of the file and come back later; etc.
Thus, there exists no solution which will work for all possible programs within the constraint of requiring a "pipe".
First, what will work if scour.inkscape.py
can read from a FIFO:
python scour.inkscape.py <(python dxf_input.py sample.dxf)
If it can't read from a FIFO, but instead requires a regular file, bash doesn't have a relevant primitive, but zsh does:
# This needs zsh, not bash
python scour.inkscape.py =(python dxf_input.py sample.dxf)