Running a pure script without a ledger?

Related to posts

Is there a way to run a pure script that doesn’t execute any Commands without connecting to a ledger?
For instance, using daml script but without the --ledger-host option?

What I’m trying to achieve here is to run a scenario : Script Text and output the resulting string.
I could of course fail the script and use debug, but that’s kind of horrible.

You two concerns are a bit unrelated.

Currently the Daml script command line requires a ledger to connect to. The only way to run a script without a functional ledger is inside Daml Studio.

On the other hand, to get the output of a script, you can use the option --output-file to specify a file where the result of the script will be written to in JSON format.

Yes, I got this bit - I think it’s mentioned in one of the linked posts.

What I don’t want is to have to do is daml start to spin up a ledger every time i run daml script, because I’m not actually reading/writing any contracts. I’m just evaluating a pure function.

Yes, it would have been nice to have this functionality in daml script, so that if I omit --ledger-host, it just uses the secnario-service.

For now, there is no option for this in daml script but you can use daml repl to evaluate your script which does not require a ledger. Note that it doesn’t use the scenario service either, it will just fail for ledger operations but if I understand you correctly that’s fine for your usecase.