Reputation: 7913
I'm working for a university and they have their own libraries and paths for python libraries. Every time I start ipython
, I need to run a shell script (e.g. /etc/university/env.sh
)
The problem is that emacs doesn't recognize the env.sh file. When I do py-shell, emacs always envokes Python WITHOUT any pre-set environment variables.
Is there a way to make emacs run /etc/corporate/env.sh
before starting python?
Upvotes: 1
Views: 413
Reputation: 4804
After running your /etc/university/env.sh, start Emacs from this shell. Then the variables set before are known.
Upvotes: 0
Reputation: 20372
In /home/ccfenix/mypython.sh
(make sure chmod +x
, Emacs does this on auto):
#!/bin/bash
# . /etc/corporate/env.sh
export SOMEVAR=10
python "$@"
In ~/.emacs
:
(defun my-python ()
(interactive)
(ansi-term "/home/ccfenix/mypython.sh"))
And to test: M-x mypython:
import os
print os.environ["SOMEVAR"]
# => 10
Upvotes: 1