Bases: accounting.storage.Storage
Writes a transaction to the ledger file by opening it in ‘ab’ mode and writing a ledger transaction based on the Transaction instance in transaction.
Returns a list of arguments suitable for subprocess.Popen based on self.ledger_bin and self.ledger_file.
Returns self.ledger_process if it evaluates to True. If self.ledger_process is not set the result of self.init_process() is returned.
Creates a new (presumably) ledger subprocess based on the args from Ledger.assemble_arguments() and then runs Ledger.read_until_prompt() once (which should return the banner text) and discards the output.
Context manager that checks that the ledger process is not already locked, then “locks” the process and yields the process handle and unlocks the process when execution is returned.
Since this decorated as a contextlib.contextmanager() the recommended use is with the with-statement.
with self.locked_process() as p:
p.stdin.write(b'bal\n')
output = self.read_until_prompt(p)