[ERROR] Missing file or input input stream
There's an issue when piping into kscript . Example:
notedown --strip r_chunks_example.md | kscript -t 'lines.filterNot { it.contains("%%R") }.print()'> ${mdBaseName}.ipynb
This seems a to happen if python is the pipe source. Still unclear why it happens.
I am getting the same error on piping too, but mostly (maybe always) if I pipe kscript to kscript.
$ kscript --clear-cache
Cleaning up cache...
$ echo "foo" | kscript -t 'lines.map{ it + " bar" }.print()' | kscript -t 'lines.map{ it + " baz" }.print()'
[kscript] Resolving dependencies...
[kscript] Resolving dependencies...
[kscript] Resolving com.github.holgerbrandl:kscript-support:1.2.5...[kscript] Resolving com.github.holgerbrandl:kscript-support:1.2.5...Done
Done
[kscript] Dependencies resolved
[kscript] Dependencies resolved
foo bar baz
$ echo "foo" | kscript -t 'lines.map{ it + " bar" }.print()' | kscript -t 'lines.map{ it + " baz" }.print()'
[ERROR] Missing file or input input stream
$ kscript --clear-cache
Cleaning up cache...
$ echo "foo" | kscript -t 'lines.map{ it + " bar" }.print()' | kscript -t 'lines.map{ it + " baz" }.print()'
[kscript] Resolving dependencies...
[kscript] Resolving dependencies...
[kscript] Resolving com.github.holgerbrandl:kscript-support:1.2.5...[kscript] Resolving com.github.holgerbrandl:kscript-support:1.2.5...Done
[kscript] Dependencies resolved
Done
[kscript] Dependencies resolved
[ERROR] Missing file or input input stream
There is something very strange on this happening. On first run everything is ok, but proceeding executions will all fail.
First I thought clearing the cache works (I think it did few times) but it does not. What I have noticed to work is making a change to the latter script:
$ echo "foo" | kscript -t 'lines.map{ it + " bar" }.print()' | kscript -t 'lines.map{ it + " x baz" }.print()'
foo bar x baz
$ echo "foo" | kscript -t 'lines.map{ it + " bar" }.print()' | kscript -t 'lines.map{ it + " x baz" }.print()'
[ERROR] Missing file or input input stream
This behaviour is strange. How come clearing the caches do not fix it, but changing the script does? Is there some other state stored somewhere?
Indeed, very strange. It's a good step forward that you could simply the example to
echo "foo" | kscript -t 'lines.map{ it + " bar" }.print()' | kscript -t 'lines.map{ it + " baz" }.print()'