Re: environment variable

2017-06-24 Thread Cameron Simpson
On 24Jun2017 21:31, Gene Heskett wrote: On Saturday 24 June 2017 21:03:18 Steve D'Aprano wrote: On Sun, 25 Jun 2017 08:39 am, Gene Heskett wrote: > On Saturday 24 June 2017 16:49:25 Smith wrote: >> Hello to all, >> I wanted to ask you how I could delete a line of an env

Re: environment variable

2017-06-24 Thread Gene Heskett
On Saturday 24 June 2017 21:03:18 Steve D'Aprano wrote: > On Sun, 25 Jun 2017 08:39 am, Gene Heskett wrote: > > On Saturday 24 June 2017 16:49:25 Smith wrote: > >> Hello to all, > >> I wanted to ask you how I could delete a line of an environment > >> va

Re: environment variable

2017-06-24 Thread Steve D'Aprano
On Sun, 25 Jun 2017 08:39 am, Gene Heskett wrote: > On Saturday 24 June 2017 16:49:25 Smith wrote: > >> Hello to all, >> I wanted to ask you how I could delete a line of an environment >> variable (PATH) [...] > export PATH= > > but be prepared to type the full

Re: environment variable

2017-06-24 Thread Gene Heskett
On Saturday 24 June 2017 16:49:25 Smith wrote: > Hello to all, > I wanted to ask you how I could delete a line of an environment > variable (PATH) > > ~/Scaricati/pycharm-2017.1.4/bin$ echo $PATH | sed s/:/'\n'/g > /usr/local/sbin > /usr/local/bin > /usr/sbi

Re: environment variable

2017-06-24 Thread Michael F. Stemper
On 2017-06-24 15:49, Smith wrote: Hello to all, I wanted to ask you how I could delete a line of an environment variable (PATH) ~/Scaricati/pycharm-2017.1.4/bin$ echo $PATH | sed s/:/'\n'/g /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games

environment variable

2017-06-24 Thread Smith
Hello to all, I wanted to ask you how I could delete a line of an environment variable (PATH) ~/Scaricati/pycharm-2017.1.4/bin$ echo $PATH | sed s/:/'\n'/g /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /path/to/my/program ---

Re: Modify environment variable for subprocess

2015-09-23 Thread Akira Li
loial writes: > I need to modify the LIBPATH environment variable when running a > process via subprocess, but otherwise retain the existing environment. > > Whats the best way to do that? Pass env=dict(os.environ, LIBPATH=value) parameter: import os impor

Re: Modify environment variable for subprocess

2015-09-23 Thread Laura Creighton
In a message of Wed, 23 Sep 2015 02:51:53 -0700, loial writes: >I need to modify the LIBPATH environment variable when running a process via >subprocess, but otherwise retain the existing environment. > >Whats the best way to do that? import subprocess, os my_env = os.environ # if

Re: Modify environment variable for subprocess

2015-09-23 Thread Cameron Simpson
On 23Sep2015 02:51, loial wrote: I need to modify the LIBPATH environment variable when running a process via subprocess, but otherwise retain the existing environment. Whats the best way to do that? Make a copy of os.environ, modify the copy, pass it via the env=parameter of

Modify environment variable for subprocess

2015-09-23 Thread loial
I need to modify the LIBPATH environment variable when running a process via subprocess, but otherwise retain the existing environment. Whats the best way to do that? -- https://mail.python.org/mailman/listinfo/python-list

Re: Error getting REMOTE_USER Environment Variable

2014-02-21 Thread MRAB
On 2014-02-21 22:48, Hobie Audet wrote: How many other environment variables are doubled? All of them? The only other environment variable I have tried is REMOTE_ADDR, and that does not appear to be doubled. Does the problem exist when the Python script is run directly, outside Abyss, or

Re: Error getting REMOTE_USER Environment Variable

2014-02-21 Thread Hobie Audet
How many other environment variables are doubled? All of them? The only other environment variable I have tried is REMOTE_ADDR, and that does not appear to be doubled. Does the problem exist when the Python script is run directly, outside Abyss, or in IDLE, for example? The problem is

Re: Error getting REMOTE_USER Environment Variable

2014-02-20 Thread John Gordon
In Hobie Audet writes: > 7. What it echoes back is "userxyzuserxyz". In other words, the > REMOTE_USER value is repeated. What username is recorded in the access_log file? > executed correctly. By why the "REMOTE_USER" value is doubled is > beyond my understanding. Is this a bug in the

Re: Error getting REMOTE_USER Environment Variable

2014-02-20 Thread MRAB
On 2014-02-20 14:53, Hobie Audet wrote: I'm running the Abyss Web Server X1 (v 2.9.0.1) on a Windows XP Home (SP3) system and am using Python 3.3 for a scripting language. I'm having a problem getting the environment variable "REMOTE_USER". Here's the situation:

Error getting REMOTE_USER Environment Variable

2014-02-20 Thread Hobie Audet
I'm running the Abyss Web Server X1 (v 2.9.0.1) on a Windows XP Home (SP3) system and am using Python 3.3 for a scripting language. I'm having a problem getting the environment variable "REMOTE_USER". Here's the situation: 1. I have created a user under Abyss. Th

Re: [Q] How to specify options for 'setup.py install' by environment variable?

2012-06-10 Thread Makoto Kuwata
On Sun, Jun 10, 2012 at 3:51 PM, Ned Deily wrote: >> >> Thank you Ned, >> but I can't find environment variable name on that page which is >> equivarent to '--install-scripts' or other options. > > Sorry, I wasn't clear.  Using the Distutils conf

Re: [Q] How to specify options for 'setup.py install' by environment variable?

2012-06-09 Thread Ned Deily
gt;> For example: > >> > >>   $ python setup.py install --prefix=$PWD/local --install-scripts=$PWD/bin > >> > >> Question: is it possible to specify these options by environment variable? > >> I want to specify --prefix or --install-scripts option

Re: [Q] How to specify options for 'setup.py install' by environment variable?

2012-06-09 Thread Makoto Kuwata
thon setup.py install --prefix=$PWD/local --install-scripts=$PWD/bin >> >> Question: is it possible to specify these options by environment variable? >> I want to specify --prefix or --install-scripts options, but it is >> too troublesome for me to specify them in command l

Re: [Q] How to specify options for 'setup.py install' by environment variable?

2012-06-09 Thread Ned Deily
possible to specify these options by environment variable? > I want to specify --prefix or --install-scripts options, but it is > too troublesome for me to specify them in command line every time. There are some environment variable options for Distutils-based (i.e. with setup.py) ins

[Q] How to specify options for 'setup.py install' by environment variable?

2012-06-09 Thread Makoto Kuwata
Hi, "setup.py install" command supports options such as --prefix, --install-scripts, and so on. For example: $ python setup.py install --prefix=$PWD/local --install-scripts=$PWD/bin Question: is it possible to specify these options by environment variable? I want to specify -

Re: Setting an environment variable.

2012-01-03 Thread Nobody
On Tue, 03 Jan 2012 15:45:20 +1000, Ashton Fagg wrote: > I'm working with an embedded machine, which is using a Python script to > oversee the acquisition of some data. The supervisor script, which is > run by crontab every 5 minutes, relies on an environment variable to be >

Setting an environment variable.

2012-01-02 Thread Ashton Fagg
Hi list. A bit new to Python so please forgive my potential ignorance. I'm working with an embedded machine, which is using a Python script to oversee the acquisition of some data. The supervisor script, which is run by crontab every 5 minutes, relies on an environment variable to be

Re: ENVIRONMENT Variable expansion in ConfigParser

2010-10-14 Thread Rodrick Brown
How about doing something like host.name=%HOSTNAME% Then when you parse in the value %HOSTNAME% from your configParser module you do a pattern substitution of %HOSTNAME% with os.environ['HOSTNAME']. Sent from my iPhone 4. On Oct 14, 2010, at 7:57 PM, pikespeak wrote: > Hi, > I am using Conf

ENVIRONMENT Variable expansion in ConfigParser

2010-10-14 Thread pikespeak
Hi, I am using ConfigParser module and would like to know if it has the feature to autoexpand environment variables. For example currently, I have the below section in config where hostname is hardcoded. I would like it to be replaced with the values from the env variable os.envion['HOSTNAME'] so t

Re: passing environment variable path to open command

2010-06-11 Thread Mahmood Naderan
.org Sent: Fri, June 11, 2010 2:05:15 PM Subject: Re: passing environment variable path to open command Am 11.06.2010 10:39, schrieb Mahmood Naderan: > Hi, > I am new to python so my question may be very basic. > Suppose I have a file (sc_1.sh) which the path to that file is in system path: >

Re: passing environment variable path to open command

2010-06-11 Thread Christian Heimes
Am 11.06.2010 10:39, schrieb Mahmood Naderan: > Hi, > I am new to python so my question may be very basic. > Suppose I have a file (sc_1.sh) which the path to that file is in system path: > SOMETHING=/home/mahmood/scripts > > Now I want to open that file with respect to the en

Re: passing environment variable path to open command

2010-06-11 Thread Jean-Michel Pichavant
Mahmood Naderan wrote: Hi, I am new to python so my question may be very basic. Suppose I have a file (sc_1.sh) which the path to that file is in system path: SOMETHING=/home/mahmood/scripts Now I want to open that file with respect to the environment variable: import os env

passing environment variable path to open command

2010-06-11 Thread Mahmood Naderan
Hi, I am new to python so my question may be very basic. Suppose I have a file (sc_1.sh) which the path to that file is in system path: SOMETHING=/home/mahmood/scripts   Now I want to open that file with respect to the environment variable:    import os    env = os.getenv("SOMETHING")   

Re: Passing environment variable to "subprocess" causes failure

2009-02-03 Thread Miki
> Code A: > > p = subprocess.Popen( ['python', '-V'], env={ 'PYTHONPATH': 'C:/ > Documents and Settings/David Gould/workspace/DgTools/Common/Trunk/ > Source' } ) > print p.communicate()[0] > print p.returncode > > Output: > > None > -1072365564 My *guess* is that since PATH is not in the environme

Re: Passing environment variable to "subprocess" causes failure

2009-02-03 Thread rdmurray
Quoth MRAB : > davidgo...@davidgould.com wrote: > > I'm attempting to run subprocess and passing in an environment > > variable. When I do this the child process fails with an error. When I > > don't pass an environement variable it runs fine. > > >

Re: Passing environment variable to "subprocess" causes failure

2009-02-03 Thread MRAB
davidgo...@davidgould.com wrote: > I'm attempting to run subprocess and passing in an environment > variable. When I do this the child process fails with an error. When I > don't pass an environement variable it runs fine. > > BTW Running this code under Windows XP wit

Passing environment variable to "subprocess" causes failure

2009-02-03 Thread davidgould
I'm attempting to run subprocess and passing in an environment variable. When I do this the child process fails with an error. When I don't pass an environement variable it runs fine. BTW Running this code under Windows XP with Python 2.6.1 Code A: p = subprocess.Popen( ['pyth

Re: set DOS environment variable

2008-10-02 Thread Dan Upton
On Thu, Oct 2, 2008 at 11:18 AM, bill <[EMAIL PROTECTED]> wrote: > Hi all, > > Can Python set a DOS environment variable? > > TIA, > > Bill I'd look at http://www.python.org/doc/2.5.2/lib/os-procinfo.html . It looks like putenv should do what you want. It might

set DOS environment variable

2008-10-02 Thread bill
Hi all, Can Python set a DOS environment variable? TIA, Bill -- http://mail.python.org/mailman/listinfo/python-list

Re: PYTHONSITEDIR environment variable

2008-09-09 Thread ago
single working-env per user. The > > latter could still be achieved by setting the appropriate environment > > variable in the user profile. Do you think it would be possible to > > accommodate for the above in your PEP? > > Isn't PYTHONUSERBASE sufficient for your need

Re: PYTHONSITEDIR environment variable

2008-09-09 Thread ago
Small variation on the above patch, using 2 environment variables: PYTHONSITEDIR allows for local site-packages (that override system site packages), and PYTHONNOSYSSITES skips system site-packages for "clean-room" operation (similar to virtual-python.py --no-site- packages). --- /usr/lib/python2

Re: PYTHONSITEDIR environment variable

2008-09-09 Thread Christian Heimes
ago wrote: The only thing I would add is that in my experience I often use different working-envs for different projects, so I'd prefer to have a more generic solution as opposed to a single working-env per user. The latter could still be achieved by setting the appropriate environment var

Re: PYTHONSITEDIR environment variable

2008-09-09 Thread ago
xperience I often use different working-envs for different projects, so I'd prefer to have a more generic solution as opposed to a single working-env per user. The latter could still be achieved by setting the appropriate environment variable in the user profile. Do you think it would be possible to

Re: PYTHONSITEDIR environment variable

2008-09-09 Thread Christian Heimes
ago wrote: Wouldn't it be possible to support a PYTHONSITEDIR environment variable in site.py for this purpose? I have attached a possible patch. In what follows, if PYTHONSITEDIR is defined, that dir is used as the only source of site-packages, extra paths can easily be added by creating a

PYTHONSITEDIR environment variable

2008-09-09 Thread ago
get close, but not quite there, and the above scripts seem a bit over the top. Wouldn't it be possible to support a PYTHONSITEDIR environment variable in site.py for this purpose? I have attached a possible patch. In what follows, if PYTHONSITEDIR is defined, that dir is used as the only sourc

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Asun Friere
On Aug 18, 11:17 pm, "Shawn Milochik" <[EMAIL PROTECTED]> wrote: > > The easiest solution (in my opinion) is to write a bash script to > execute your Python script, and use that bash script to add those > environment variables. Agreed. Wrap it in a shell script, easier to read and grow than a on

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Asun Friere
On Aug 19, 2:37 am, "Stephen Cattaneo" <[EMAIL PROTECTED]> wrote: > - What did you run in the cronjob to get back all those variables? > > set; echo "-"; echo "import os; print > os.environ" | python > > Cheers, > > S As I should have noted from $BASH_EXECUTION_STRING. I'd be hal

RE: Python does not get environment variable when using cron.

2008-08-18 Thread Stephen Cattaneo
PM - To: python-list@python.org - Subject: Re: Python does not get environment variable when using cron. - - On Aug 18, 11:15 am, "Stephen Cattaneo" - <[EMAIL PROTECTED]> wrote: - > Hello all, - > - > I am attempting to execute an automated test (written in Python) via - > cron

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Shawn Milochik
Here's a more "English" version of what people are trying to explain: When you log into a Unix session, certain files in your home directory are read and add environment variables to your session. When you run a cron job, it does not do this. It still runs as "you" as far as permissions go, but it

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Edwin . Madari
9:39 PM To: python-list@python.org Subject: Re: Python does not get environment variable when using cron. I'm not sure about the environment variable, but os.uname() should give you what you need otherwise. -- http://mail.python.org/mailman/listinfo/python-list The information contain

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Maric Michaud
Le Monday 18 August 2008 07:11:59 Cameron Simpson, vous avez écrit : > You're probably confused by the fact that cron does not invoke "login" > shells (with their associated initialisation from /etc/profile and > $HOME/.profile). This can be solved by invoking /bin/bash -l -c ..., the -l option fo

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Cameron Simpson
On 17Aug2008 21:25, John Nagle <[EMAIL PROTECTED]> wrote: > Stephen Cattaneo wrote: >> I am attempting to execute an automated test (written in Python) via >> cron. I have to check the HOSTNAME variable as part of the test, oddly >> under cron the HOSTNAME environ

Re: Python does not get environment variable when using cron.

2008-08-17 Thread John Nagle
Stephen Cattaneo wrote: Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment variable is not in the os.environ dictionary. I know that cron runs in a subshell

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Asun Friere
On Aug 18, 11:15 am, "Stephen Cattaneo" <[EMAIL PROTECTED]> wrote: > Hello all, > > I am attempting to execute an automated test (written in Python) via > cron. I have to check the HOSTNAME variable as part of the test, oddly > under cron the HOSTNAME environment va

Re: Python does not get environment variable when using cron.

2008-08-17 Thread John Machin
On Aug 18, 11:38 am, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > I'm not sure about the environment variable, but os.uname() should > give you what you need otherwise. As documented, it should but may not ... consider using socket.gethost* -- http://mail.python.org/mailman/listinfo/python-list

Re: Python does not get environment variable when using cron.

2008-08-17 Thread Eric Wertman
I'm not sure about the environment variable, but os.uname() should give you what you need otherwise. -- http://mail.python.org/mailman/listinfo/python-list

Python does not get environment variable when using cron.

2008-08-17 Thread Stephen Cattaneo
Hello all, I am attempting to execute an automated test (written in Python) via cron. I have to check the HOSTNAME variable as part of the test, oddly under cron the HOSTNAME environment variable is not in the os.environ dictionary. I know that cron runs in a subshell that does not have all of

Re: urllib2 weirdness when https_proxy environment variable is exported

2007-10-29 Thread Devraj
t with the Google Data API. The Google Data API uses httplib to > > place all of its requests. However I have been using urllib2 and some > > handlers that I discovered in an ASPN article to handle HTTPS proxies > > in my code. > > > The Google Data API relies on

Re: urllib2 weirdness when https_proxy environment variable is exported

2007-10-27 Thread John J. Lee
d in an ASPN article to handle HTTPS proxies > in my code. > > The Google Data API relies on an environment variable called > https_proxy to get information about the proxy to be used. However > urllib2 starts spitting out the BadStatusLine exception if the > https_proxy envi

urllib2 weirdness when https_proxy environment variable is exported

2007-10-25 Thread Devraj
in my code. The Google Data API relies on an environment variable called https_proxy to get information about the proxy to be used. However urllib2 starts spitting out the BadStatusLine exception if the https_proxy environment variable is found. Has anyone experienced similar things with urllib2? Is

Re: how can I find out the value of an environment variable?

2007-03-07 Thread Tim Roberts
"ken" <[EMAIL PROTECTED]> wrote: > >how can I find out the value of an environment variable in my pythong >script? C:\Apps\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright&qu

Re: how can I find out the value of an environment variable?

2007-03-05 Thread MonkeeSage
On Mar 5, 8:22 pm, "ken" <[EMAIL PROTECTED]> wrote: > how can I find out the value of an environment variable in my pythong > script? > > Thank you. RTFM... os.getenv http://docs.python.org/lib/os-procinfo.html Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

how can I find out the value of an environment variable?

2007-03-05 Thread ken
how can I find out the value of an environment variable in my pythong script? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Set Windows Environment Variable

2006-03-30 Thread Fuzzyman
Fredrik Lundh wrote: > Fuzzyman wrote: > > > I *believe* that ``SetEnvironmentVariable`` exists in the underlying > > windows API, but that it isn't wrapped by the win32api extension. > > SetEnvironmentVariable does the same thing as assignment to os.environ. > > The only way to set the environmen

Re: Set Windows Environment Variable

2006-03-30 Thread Fredrik Lundh
Fuzzyman wrote: > I *believe* that ``SetEnvironmentVariable`` exists in the underlying > windows API, but that it isn't wrapped by the win32api extension. SetEnvironmentVariable does the same thing as assignment to os.environ. The only way to set the environment for another process is to create

Re: Set Windows Environment Variable

2006-03-30 Thread Duncan Booth
Fuzzyman wrote: > > Magnus Lycka wrote: >> Surely there must be a way to programatically set up the >> environment variables for not yet started processes? I.e. >> doing the same as when you manually change things in the >> control panel. I'm pretty sure many Windows installers do >> that, and wh

Re: Set Windows Environment Variable

2006-03-30 Thread Fuzzyman
Magnus Lycka wrote: > Duncan Booth wrote: > > Fuzzyman wrote: > >> In the ``win32api`` package there is a ``GetEnvironmentVariable`` > >> function, but no ``SetEnvironmentVariable``. Any options ? > > > > No, your only option is to find a solution which doesn't involve changing > > another process

Re: Set Windows Environment Variable

2006-03-30 Thread Magnus Lycka
Duncan Booth wrote: > Fuzzyman wrote: >> In the ``win32api`` package there is a ``GetEnvironmentVariable`` >> function, but no ``SetEnvironmentVariable``. Any options ? > > No, your only option is to find a solution which doesn't involve changing > another process's environment. Surely there mus

Re: Set Windows Environment Variable

2006-03-30 Thread Duncan Booth
Fuzzyman wrote: > Hello all, > > I would like to set a Windows Environment variable for another > (non-child) process. > > This means that the following *doesn't* work : :: > > os.environ['NAME'] = value > > In the ``win32api`` package there is

Set Windows Environment Variable

2006-03-30 Thread Fuzzyman
Hello all, I would like to set a Windows Environment variable for another (non-child) process. This means that the following *doesn't* work : :: os.environ['NAME'] = value In the ``win32api`` package there is a ``GetEnvironmentVariable`` function, but no ``SetEnvironment

Re: PATH environment variable

2005-11-20 Thread mirandacascade
Fredrik Lundh wrote: > what part of your observations makes you think that the environment isn't > "captured" (i.e. > copied from the process environment) when the os module is > imported ? Answer: the part that was informed by a fundamental misunderstanding on my part of how the os module obtai

Re: PATH environment variable

2005-11-20 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Do these observations fit with what is stated in section 6.1.1 of the > Python Library Reference? yes. what part of your observations makes you think that the environment isn't "captured" (i.e. copied from the process environ- ment) when the os module is imported ? (h

Re: PATH environment variable

2005-11-20 Thread mirandacascade
hat the PATH variable was, in fact, changed) 5) in interactive window, del os 6) in interactive window, import os 7) os.environ['PATH'] - presents the same value as in #3 I also observed that if I exit the interactive window, and then go back into the interactive window, the os.environ[&#

Re: PATH environment variable

2005-11-20 Thread Jeffrey Schwab
[EMAIL PROTECTED] wrote: > O/S: Win2K > Vsn of Python:2.4 > > Based on a search of other posts in this group, it appears as though > os.environ['PATH'] is one way to obtain the PATH environment variable. > > My questions: > 1) is it correct that os.environ[&#x

Re: PATH environment variable

2005-11-20 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Based on a search of other posts in this group, it appears as though > os.environ['PATH'] is one way to obtain the PATH environment variable. > > My questions: > 1) is it correct that os.environ['PATH'] contains the PATH environmen

PATH environment variable

2005-11-19 Thread mirandacascade
O/S: Win2K Vsn of Python:2.4 Based on a search of other posts in this group, it appears as though os.environ['PATH'] is one way to obtain the PATH environment variable. My questions: 1) is it correct that os.environ['PATH'] contains the PATH environment variable? 2) are

Re: Set an environment variable

2005-10-27 Thread Jorgen Grahn
;>> On 2005-10-24, Eric Brunel <[EMAIL PROTECTED]> wrote: >>>> >> The only think you can export an environment variable to is a >>>> >> child process >>>> > Well, you know that, and I know that too. From my experience, >>>> > m

Re: Set an environment variable

2005-10-26 Thread Mike Meyer
Jorgen Grahn <[EMAIL PROTECTED]> writes: > On Wed, 26 Oct 2005 07:42:19 -0700, Alex Martelli <[EMAIL PROTECTED]> wrote: >> Grant Edwards <[EMAIL PROTECTED]> wrote: >>> On 2005-10-24, Eric Brunel <[EMAIL PROTECTED]> wrote: >>> >> The

Re: Set an environment variable

2005-10-26 Thread Jorgen Grahn
On Wed, 26 Oct 2005 07:42:19 -0700, Alex Martelli <[EMAIL PROTECTED]> wrote: > Grant Edwards <[EMAIL PROTECTED]> wrote: > >> On 2005-10-24, Eric Brunel <[EMAIL PROTECTED]> wrote: >> >> >> The only think you can export an environment variable to i

Re: Set an environment variable

2005-10-26 Thread Alex Martelli
Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2005-10-24, Eric Brunel <[EMAIL PROTECTED]> wrote: > > >> The only think you can export an environment variable to is a > >> child process > > > > Well, you know that, and I know that too. From m

Re: Set an environment variable

2005-10-24 Thread Grant Edwards
On 2005-10-24, Eric Brunel <[EMAIL PROTECTED]> wrote: >> The only think you can export an environment variable to is a >> child process > > Well, you know that, and I know that too. From my experience, > many people don't... True. Using Unix for 20+ years pr

Re: Set an environment variable

2005-10-24 Thread Eric Brunel
On Fri, 21 Oct 2005 20:13:32 -, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2005-10-21, Mike Meyer <[EMAIL PROTECTED]> wrote: >> Grant Edwards <[EMAIL PROTECTED]> writes: >>> My point: the OP wanted to know how to export an environment >>> vari

Re: Set an environment variable

2005-10-21 Thread Grant Edwards
On 2005-10-21, Mike Meyer <[EMAIL PROTECTED]> wrote: > Grant Edwards <[EMAIL PROTECTED]> writes: >> My point: the OP wanted to know how to export an environment >> variable to a child process. Either of the lines of code above >> will do that, so what

Re: Set an environment variable

2005-10-21 Thread Mike Meyer
Grant Edwards <[EMAIL PROTECTED]> writes: > My point: the OP wanted to know how to export an environment > variable to a child process. Either of the lines of code above > will do that, so what's with all the shellular shenanigans? Actually, the OP didn't say he wanted

Re: Set an environment variable

2005-10-21 Thread Grant Edwards
hit. Are people being intentionally misleading?? > > No. Are you being intentionally - never mind. Well, yes, probably. >> And even Google knows the correct answer >> >> http://www.google.com/search?hl=en&lr=&q=python+set+environment+variable >> >>

Re: Set an environment variable

2005-10-21 Thread Mike Meyer
-- > > Bullshit. Are people being intentionally misleading?? No. Are you being intentionally - never mind. > And even Google knows the correct answer > > http://www.google.com/search?hl=en&lr=&q=python+set+environment+variable > > Follow the first hit. The first h

Re: Set an environment variable

2005-10-21 Thread Grant Edwards
calls a .sh script that executes the > export command and then calls another .py script (and how would the > first .py script look)? Good grief, that's ugly. Just use os.putenv(). > That would be much more what is my basic problem. And even Google knows the correct answer http

Re: Set an environment variable

2005-10-21 Thread Christian
Steve Holden wrote: > Time you answered your own questions by trying things at the interactive > interpreter prompt! > > regards > Steve Right again, Steve. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Set an environment variable

2005-10-21 Thread Steve Holden
Christian wrote: > Steve Holden wrote: > > >>:: >>one.py >>:: >>import os >>os.environ['STEVE'] = "You are the man" >>os.system("python two.py") >>print "Ran one" >>:: >>two.py >>:: >>import os >>print "STEVE is", os.environ['STEVE'] >>print "Ran tw

Re: Set an environment variable

2005-10-21 Thread Christian
Steve Holden wrote: > :: > one.py > :: > import os > os.environ['STEVE'] = "You are the man" > os.system("python two.py") > print "Ran one" > :: > two.py > :: > import os > print "STEVE is", os.environ['STEVE'] > print "Ran two" > [EMAIL PROTECTED] t

Re: Set an environment variable

2005-10-21 Thread Chris F.A. Johnson
> executed from a command promt than when executed from a starter .py script? No; it's always the same: an environment variable will only be effective in the process in which it is set, and its children. When you call another program, whether it's a shell script, python scr

Re: Set an environment variable

2005-10-21 Thread Steve Holden
Christian wrote: >>The closest thing you can do is that: >> >>-myScript.py-- >>print 'export MY_VARIABLE=value' >>-- >> >>-myScript.sh-- >>python myScript.py > /tmp/chgvars.sh >>.

Re: Set an environment variable

2005-10-21 Thread Sybren Stuvel
Mike Meyer enlightened us with: > It's simpler to use eval and command substitution: > > eval $(python myScript.py) This looks like the best solution to me. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just tak

Re: Set an environment variable

2005-10-21 Thread Christian
Erik Max Francis wrote: > Christian wrote: > >> Can I write a .py script that calls a .sh script that executes the >> export command and then calls another .py script (and how would the >> first .py script look)? > > No, the shell script that the Python program would invoke would be a > differ

Re: Set an environment variable

2005-10-21 Thread Erik Max Francis
Christian wrote: > Can I write a .py script that calls a .sh script that executes the > export command and then calls another .py script (and how would the > first .py script look)? No, the shell script that the Python program would invoke would be a different process and so commands executed

Re: Set an environment variable

2005-10-21 Thread Christian
> > The closest thing you can do is that: > > -myScript.py-- > print 'export MY_VARIABLE=value' > -- > > -myScript.sh-- > python myScript.py > /tmp/chgvars.sh > . /tmp/chgvars.

Re: Set an environment variable

2005-10-20 Thread Mike Meyer
"Eric Brunel" <[EMAIL PROTECTED]> writes: > -myScript.py-- > print 'export MY_VARIABLE=value' > -- > > -myScript.sh-- > python myScript.py > /tmp/chgvars.sh > . /tmp/chgvars.sh I

Re: Set an environment variable

2005-10-20 Thread Grant Edwards
On 2005-10-20, Christian <[EMAIL PROTECTED]> wrote: > How do I export an environment variable in a .py script? http://www.python.org/doc/current/lib/os-procinfo.html#l2h-1548 -- Grant Edwards grante Yow! My BIOLOGICAL ALARM

Re: Set an environment variable

2005-10-20 Thread Grant Edwards
On 2005-10-20, the_crazy88 <[EMAIL PROTECTED]> wrote: > os.system("export PYTHONPATH = %s" %("your_pythonpath")) No, that won't work. That will set the environment variable in the shell spawned by the os.system command. That shell will then immediately exit

Re: Set an environment variable

2005-10-20 Thread Eric Brunel
On 20 Oct 2005 01:58:44 -0700, the_crazy88 <[EMAIL PROTECTED]> wrote: > Just use > os.system("export PYTHONPATH = %s" %("your_pythonpath")) ... except it won't work: os.system will execute the command in a new process, so the environment variable change w

Re: Set an environment variable

2005-10-20 Thread Christian
Thanks Jeff and the crazy 88. -- http://mail.python.org/mailman/listinfo/python-list

Re: Set an environment variable

2005-10-20 Thread jepler
In Unix, you generally can't affect the environment of your parent program (in a broad sense, which includes environment variables, current working directory, opened files, effective user ID, etc). You have two basic choices to achieve an effect like this. First, you can start a subshell with the

Re: Set an environment variable

2005-10-20 Thread the_crazy88
Just use os.system("export PYTHONPATH = %s" %("your_pythonpath")) -- http://mail.python.org/mailman/listinfo/python-list

Set an environment variable

2005-10-19 Thread Christian
Another question from a not even newbie: In Unix you can set an environment variable with the command export PYTHONPATH but I would like to set the variable from at .py script. So my question is: How do I export an environment variable in a .py script? Thanks Chris -- http

Re: Environment Variable

2005-07-18 Thread Raymond Hettinger
[Vivek Chaudhary] > Is it possible to set an environment variable in python script whose > value is retained even after the script exits. There is an indirect approach: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/159462 Raymond -- http://mail.python.org/mailman/listinfo/

  1   2   >