export XUVTOP=$HOME/Documents/Python/CHIANTI_7.0_data/
If I open the Terminal and type 'env' the variable shows properly.
However, when I open Spyder and select iPython, then type 'env'
the environment variable does not show. I presume this means Spyder's
Python (installed under Macports) is not seeing the .profile file?
Where do I add the information so that Spyder will find it?
DN
(PS I seem to have three Pythons installed, Enthought, Apple and the
Macports install. I have deactivated the Enthought one in the OS
PATH.)
I am not sure how it works on Mac, but to expose a certain path to
Python I add it to my PYTHONPATH environment variable. I am not sure how
your different Python installations deal with the PYTHONPATH variable.
You can also add directories to your Python environment directly from a
script as follows:
from sys import path
path.append('/home/whateveruser/Documents/Python/CHIANTI_7.0_data/')
Hope this helps.
Regards,
David
However, I need to set a named environment variable rather than just add the path. The Spyder console has an option for adding a new path to the PYTHONPATH, but I need to do more than that. I expect that somewhere tucked away in the bowels of the disk drive there is a small file that I need to edit.
DN
> --
> You received this message because you are subscribed to the Google Groups "spyder" group.
> To post to this group, send email to spyd...@googlegroups.com.
> To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
>
import os
os.environ['XUVTOP'] =
'/home/whateveruser/Documents/Python/CHIANTI_7.0_data/'
On the other hand, there has been a similar question on the mailing list
before. There hasn't been any response as of to date:
http://groups.google.com/group/spyderlib/browse_thread/thread/8e1f900a6e26b6c7/5f0e20ccb518d96b
But then again, this might be more a discussion about where one should
set the environment variables properly. In my case (Ubuntu 10.04), any
environment variables set in the optional ~.bash_profile (which is
invoked by ~.bashrc) are known to my shell, and hence anything I launch
from that shell, including Spyder. If I now launch Spyder from a place
which does not update the environment variables as set in ~.bashrc, I
don't have access to those specific environment variables I hoped for.
For instance, again referring to Ubuntu 10.04, if I launch spyder from a
custom made launcher, it seems not to have any of the environment
variables I set myself in the ~.bashrc file. From my end I conclude that
~.bashrc is not the correct place to set system wide environment
variables. Note that any environment variables in my ~.profile file are
only set during the login procedure but are system wide (available for
spyder at all times), so any value I add during a session is not set for
the current session. I am not sure if that's the same for Mac but that
might explain your case?
It also illustrates my lack of knowledge on the matter of environment
variables :-)
Regards,
David
>> To post to this group, send email tospy...@googlegroups.com.
>> To unsubscribe from this group, send email tospyderlib...@googlegroups.com.
I hope this clarifies and/or helps.
Ryan Clary
> To post to this group, send email to spyd...@googlegroups.com.
> To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
DN
> To post to this group, send email to spyd...@googlegroups.com.
> To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
DN
One more thing…I've included a Spyder icon with my application so it looks pretty ;)
Meantime I had worked out how to use Automator (rather than Script Editor) which allowed me to incorporate what I needed (using the 'Run Shell Script' option). And I too already had a nice Spyder icon, quite like yours but with a different background :-)
I have attached the app.
DN