I am truly stumped.
This command works perfectly fine if I enter it at a terminal prompt in Ubuntu 20.04:
python3 -c 'import hddcoin.util.bech32m as b; print(b.decode_puzzle_hash("awalletaddress"). hex())'
But if I do the same command in a bash script:
PUZZLEHASH=$(python3 -c 'import hddcoin.util.bech32m as b; print(b.decode_puzzle_hash("awalletaddress"). hex())')
I get "command not found". If I change the "python3" to "venv/bin/python3", which is what I get when I do which python3
, then the error becomes "no such file or directory". Which makes me think that now it's not finding the python script I'm trying to find with the import hddcoin.util.bech32m
part. But in the bash script I am CD'd into the parent directory of that python script.
I can actually cut and paste the command as displayed in the error message into a terminal prompt and it runs fine.
I've searched everywhere and cannot find anyone asking a similar question. All searches for "no such file or directory" are failing when entered into a terminal prompt. No one has had an issue with working fine in terminal but not in a bash script that I can find.
Tried shebangs #!/bin/bash and #!/usr/bin/env bash, neither work. (Corrected)
which python3
? In a terminal or in your script? If you're able to find python3, then try an easier line to test -- maybe without theimport
. A simple "Hello, world!", for example. The top of your bash script should definitely have a#!/bin/bash
as the first line. Note the#!/
as the first 3 characters...