1

I have a shell scripts that needs to be executed so that a list of environment variables can be set. I tried to execute below shell command within a cell:

! source ~/my_bash_script.sh

It does not work. None of the env variables were set.

My question is: is there any setting that could help source a shell script upon jupyter notebook start-up in VS code?

Y.Su
  • 306
  • 1
  • 2
  • 16

1 Answers1

-1

I'm a developer on the Jupyter extension for VS Code. We added a setting Jupyter: Run Startup Commands to support auto running code when a notebook is started. Please check this out, hopefully it works for you.

Ian Huff
  • 2,699
  • 1
  • 17
  • 17
  • Hi Ian, I am unable to find `Jupyter: Run Startup Commands`. I can see: 1. `Jupyter: Run Current file...` and `Jupyter: Run Selection/Line...` Do you mean `Jupyter: Specify Jupyter command line arguments`? If so, I think this only allows you to specify jupyter specific arguments rather than how to start it. This is what I have: `--no-browser --NotebookApp.iopub_data_rate_limit=10000000000.0 --ip=0.0.0.0 --port=4321` – Y.Su Jun 16 '21 at 09:27
  • Sorry if I was confusing there. That Run Startup Commands is a setting, not a command. You would need to look for it in the settings UI, it looks like you might be looking at commands. – Ian Huff Jun 16 '21 at 15:37
  • Hi I found this setting and tried to do the following but does not seem to work `"jupyter.runStartupCommands": ["! . /home/myuser/.profile_python3"]` – Oleksandr Jan 25 '22 at 20:39
  • If you look in the Jupyter section of the VS Code output window you should see output for when this command is run, might be an error for how the command is specified. – Ian Huff Feb 16 '22 at 21:28
  • How do I pass jars when a kernel is starting up – stack0114106 May 26 '22 at 18:41
  • No example usage? How do we use the setting? – wordsforthewise May 21 '23 at 18:28