Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash tree: command not found #18

Closed
TomNicholas opened this issue Aug 16, 2024 · 2 comments · Fixed by #30
Closed

bash tree: command not found #18

TomNicholas opened this issue Aug 16, 2024 · 2 comments · Fixed by #30
Labels
bug Something isn't working

Comments

@TomNicholas
Copy link
Contributor

When running the example notebook

%%bash
tree $roms_marbl_caseroot
bash: line 1: tree: command not found
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
Cell In[14], line 1
----> 1 get_ipython().run_cell_magic('bash', '', 'tree $roms_marbl_caseroot\n')

File [~/miniconda3/envs/cstar_environment/lib/python3.12/site-packages/IPython/core/interactiveshell.py:2541](http://localhost:8888/lab/tree/examples/~/miniconda3/envs/cstar_environment/lib/python3.12/site-packages/IPython/core/interactiveshell.py#line=2540), in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
   2539 with self.builtin_trap:
   2540     args = (magic_arg_s, cell)
-> 2541     result = fn(*args, **kwargs)
   2543 # The code below prevents the output from being displayed
   2544 # when using magics with decorator @output_can_be_silenced
   2545 # when the last Python token in the expression is a ';'.
   2546 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File [~/miniconda3/envs/cstar_environment/lib/python3.12/site-packages/IPython/core/magics/script.py:155](http://localhost:8888/lab/tree/examples/~/miniconda3/envs/cstar_environment/lib/python3.12/site-packages/IPython/core/magics/script.py#line=154), in ScriptMagics._make_script_magic.<locals>.named_script_magic(line, cell)
    153 else:
    154     line = script
--> 155 return self.shebang(line, cell)

File [~/miniconda3/envs/cstar_environment/lib/python3.12/site-packages/IPython/core/magics/script.py:315](http://localhost:8888/lab/tree/examples/~/miniconda3/envs/cstar_environment/lib/python3.12/site-packages/IPython/core/magics/script.py#line=314), in ScriptMagics.shebang(self, line, cell)
    310 if args.raise_error and p.returncode != 0:
    311     # If we get here and p.returncode is still None, we must have
    312     # killed it but not yet seen its return code. We don't wait for it,
    313     # in case it's stuck in uninterruptible sleep. -9 = SIGKILL
    314     rc = p.returncode or -9
--> 315     raise CalledProcessError(rc, cell)

CalledProcessError: Command 'b'tree $roms_marbl_caseroot\n'' returned non-zero exit status 127.

Instead of trying to use a bash command (that apparently isn't installed in all systems by default), can we use some python library that we can verify is installed instead?

@TomNicholas TomNicholas added the bug Something isn't working label Aug 16, 2024
@dafyddstephenson
Copy link
Contributor

surprised to learn tree isn't available off-the-shelf on macOS (as it is on Windows and all our supported HPC systems). Seems like there isn't an easy equivalent in Python. Seems we can either delete this cell (though I'm quite fond of the structural representation) or define an equivalent python function within it (kinda clunky).

@TomNicholas
Copy link
Contributor Author

That's annoying. Maybe for now we just comment out that cell with a note that it's optional, so that the notebook will run start-to-finish on all platforms. Then we leave this issue open to track the idea of doing this in python instead?

dafyddstephenson pushed a commit to dafyddstephenson/C-Star that referenced this issue Aug 16, 2024
dafyddstephenson pushed a commit to dafyddstephenson/C-Star that referenced this issue Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants