Thanks, David, that line looks like it should do the job. DN
On 29/11/2011, at 10:49 PM, David Verelst wrote: > I guess I don't understand the context of the question, but I'll give it one > more go :-) > You could manipulate environment variables of your running instance: > > 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 > > > On 29/11/11 10:17, David Nicholls wrote: >> Thanks, 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 >> >> On 29/11/2011, at 8:02 PM, David Verelst wrote: >> >>> Hi, >>> >>> 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 >>> >>> On 29/11/11 09:22, dcn wrote: >>>> I have a package which appears to have installed OK under Spyder. To >>>> run, it needs an environment variable set up which I have in >>>> my .profile file as >>>> >>>> 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.) >>>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "spyder" group. >>> To post to this group, send email [email protected]. >>> To unsubscribe from this group, send email >>> [email protected]. >>> For more options, visit this group >>> athttp://groups.google.com/group/spyderlib?hl=en. >>> > > > -- > You received this message because you are subscribed to the Google Groups > "spyder" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/spyderlib?hl=en. > -- You received this message because you are subscribed to the Google Groups "spyder" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
