I like that idea! Will try it.

In the meantime, I am still eager to know why *source* is failing (only
with zsh and only if called from within a .sh script). And also about the
proper way to change the shell for tools accounts.

On Thu, Nov 11, 2021 at 7:04 PM AntiCompositeNumber <
anticompositenum...@gmail.com> wrote:

> Instead of activating the virtual environment, you can call the python
> executable directly by its path, ie `venv/bin/python yourscript.py`.
> This will work largely the same as activating the venv, except that
> you have to always make sure to call the right executable, the shell
> won't figure it out for you.
>
> On Thu, Nov 11, 2021 at 6:57 PM Huji Lee <huji.h...@gmail.com> wrote:
> >
> > Hi all,
> >
> > Starting Nov 7, a number of the jobs I would run through Toolforge grid
> have stopped working. Each job consists of a .sh file like this on the
> first line of which I use the source command to activate a python virtual
> environment. When I run source by hand, subsequent lines work. But when I
> call the .sh file and it tries to run the source command, I get a "source:
> not found" message, the virtual environment does not get activated and
> indeed running which python returns /usr/bin/python which is bad. All my
> scripts depend on pip packages that are installed in the virtual env and
> not available with the system python.
> >
> > The main thing I did on Nov 7 was to add a line at the end of my too's
> account's .bash_profile as below:
> >
> > exec zsh
> >
> > This is because when I manually log into toolforge, I would like zsh to
> be my shell, and since tool accounts don't support chsh, I thought
> executing zsh directly from bash would be okay. But apparently, that now
> breaks the source command somehow.
> >
> > So I wonder:
> >
> > (a) Is there a way to properly change the default shell of tool accounts?
> > (b) Is there a way to make source work under zsh?
> >
> > Importantly, I know the problem is with exec zsh because once I removed
> it and logged out and back in, all scripts worked correctly.
> >
> > Thanks,
> > Huji
> > _______________________________________________
> > Cloud mailing list -- cloud@lists.wikimedia.org
> > List information:
> https://lists.wikimedia.org/postorius/lists/cloud.lists.wikimedia.org/
> _______________________________________________
> Cloud mailing list -- cloud@lists.wikimedia.org
> List information:
> https://lists.wikimedia.org/postorius/lists/cloud.lists.wikimedia.org/
>
_______________________________________________
Cloud mailing list -- cloud@lists.wikimedia.org
List information: 
https://lists.wikimedia.org/postorius/lists/cloud.lists.wikimedia.org/

Reply via email to