Holochain Forum

Trouble Switching to try-o-rama

I’m trying to switch from diorama to try-o-rama and am having trouble understanding the configuration and getting an error when it tries to read the hash from my DNA. The command the code is trying to run is getting an OS error but runs successfully in the same nix-shell hc hash -p <full path to DNA>.

got an error for  Full Test Error: Could not determine hash of DNA file '~/coding/holo-dev/jun2019devcamp/dots-and-boxes/dist/dots-and-boxes.dna.json'. Does the file exist?
	Original error: Error: Error while getting hash: /nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)

    at dna.hash.exports.getDnaHash.catch.err (/home/abraham/coding/holo-dev/jun2019devcamp/dots-and-boxes/test/node_modules/@holochain/try-o-rama/lib/config/gen.js:66:19)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
20:15:32 info: Done with test: Full Test
got unhandledRejection: Error: Could not determine hash of DNA file '~/coding/holo-dev/jun2019devcamp/dots-and-boxes/dist/dots-and-boxes.dna.json'. Does the file exist?
	Original error: Error: Error while getting hash: /nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)

    at dna.hash.exports.getDnaHash.catch.err (/home/abraham/coding/holo-dev/jun2019devcamp/dots-and-boxes/test/node_modules/@holochain/try-o-rama/lib/config/gen.js:66:19)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)

The code in question is just:

const { Orchestrator, Config } = require ('@holochain/try-o-rama')

process.on('unhandledRejection', error => {
  // Will print "unhandledRejection err is not defined"
  console.error('got unhandledRejection:', error);
});

// Point to your DNA file and give it a nickname. 
// The DNA file can either be on your filesystem...
// If id is not specified then it just strips the path and file suffix and uses that
const dnaGame = Config.dna('/home/abraham/coding/holo-dev/jun2019devcamp/dots-and-boxes/dist/dots-and-boxes.dna.json', 'dots-and-boxes')```

Hi @abrahampalmer, thanks for bringing this up. I see that there is a bug in try-o-rama around this. The problem is that if hc hash produces anything on stderr, try-o-rama gives up and returns the error. In your case, the output on stderr seems to only be a harmless warning.

We’ll fix this in the next try-o-rama release. In the meantime, you could try working around this by creating a bash script that wraps hc such that when hc hash -p is called, it ignores stderr. Something like this:

#!/bin/bash
hc "$@" 2>/dev/null 

If you have that on your PATH when running try-o-rama it may bypass the bug.