kscript icon indicating copy to clipboard operation
kscript copied to clipboard

[ERROR] Missing file or input input stream

Open holgerbrandl opened this issue 8 years ago • 3 comments

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

holgerbrandl avatar Nov 29 '17 10:11 holgerbrandl

This seems a to happen if python is the pipe source. Still unclear why it happens.

holgerbrandl avatar Dec 12 '17 00:12 holgerbrandl

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?

Arch-vile avatar Mar 14 '19 06:03 Arch-vile

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()'

holgerbrandl avatar Mar 18 '19 08:03 holgerbrandl