[issue35328] Set a environment variable for venv prompt

2020-09-21 Thread Brett Cannon
Change by Brett Cannon : -- resolution: fixed -> status: closed -> open versions: +Python 3.10 -Python 3.9 ___ Python tracker ___

[issue35328] Set a environment variable for venv prompt

2020-09-19 Thread Mathias Fredriksson
Change by Mathias Fredriksson : -- pull_requests: +21368 pull_request: https://github.com/python/cpython/pull/22324 ___ Python tracker ___

[issue35328] Set a environment variable for venv prompt

2020-09-19 Thread Mathias Fredriksson
Mathias Fredriksson added the comment: I believe GH-21587 does not fully address this issue because VIRTUAL_ENV_PROMPT is being conditionally set only if VIRTUAL_ENV_DISABLE_PROMPT is unset. Shell prompts must set VIRTUAL_ENV_DISABLE_PROMPT to non-empty to prevent venv from hijacking PS1.

[issue35328] Set a environment variable for venv prompt

2020-09-09 Thread Vinay Sajip
Change by Vinay Sajip : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue35328] Set a environment variable for venv prompt

2020-07-28 Thread Vinay Sajip
Vinay Sajip added the comment: New changeset c82dda1e08c4b74ca24f88d6a549d93108c319cf by Zackery Spytz in branch 'master': bpo-35328: Set VIRTUAL_ENV_PROMPT at venv activation (GH-21587) https://github.com/python/cpython/commit/c82dda1e08c4b74ca24f88d6a549d93108c319cf --

[issue35328] Set a environment variable for venv prompt

2020-07-21 Thread Zackery Spytz
Change by Zackery Spytz : -- nosy: +ZackerySpytz nosy_count: 6.0 -> 7.0 pull_requests: +20727 pull_request: https://github.com/python/cpython/pull/21587 ___ Python tracker ___

[issue35328] Set a environment variable for venv prompt

2019-10-31 Thread Vinay Sajip
Change by Vinay Sajip : -- versions: +Python 3.9 -Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35328] Set a environment variable for venv prompt

2019-05-23 Thread Brett Cannon
Brett Cannon added the comment: You can open a new PR with co-author or basing off of their fork if it's still around. -- ___ Python tracker ___

[issue35328] Set a environment variable for venv prompt

2019-05-23 Thread Lysandros Nikolaou
Lysandros Nikolaou added the comment: @brettcannon, yeah I saw that, but there hasn't been any progress since November. I'm still interested in this though. What would the correct workflow be? Pushing commits to the same PR or opening a new one with a co-author? --

[issue35328] Set a environment variable for venv prompt

2019-05-23 Thread Brett Cannon
Brett Cannon added the comment: @lys.nikolaou it looks like there was an initial PR, but it only updated things for Bash and not for all the other shells that we support for virtual environments. -- nosy: +brett.cannon ___ Python tracker

[issue35328] Set a environment variable for venv prompt

2019-05-19 Thread Lysandros Nikolaou
Lysandros Nikolaou added the comment: Is anybody still working on this? -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue35328] Set a environment variable for venv prompt

2019-05-19 Thread Lysandros Nikolaou
Change by Lysandros Nikolaou : -- nosy: +lys.nikolaou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35328] Set a environment variable for venv prompt

2019-01-04 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: issue34439 seems like a similar proposal. I am adding @vinay.sajip. Since this seems like a new feature I have removed 3.7 from the version list. -- components: +Library (Lib) nosy: +vinay.sajip, xtreak type: -> enhancement versions:

[issue35328] Set a environment variable for venv prompt

2018-11-27 Thread Baptiste Darthenay
Baptiste Darthenay added the comment: How the venv prompt name would be displayed in a project like Powerline? Or in VS Code? https://i.ibb.co/JHYrnk2/Screenshot-from-2018-11-27-19-41-47.png Or in my custom prompt?

[issue35328] Set a environment variable for venv prompt

2018-11-27 Thread Anthony Sottile
Anthony Sottile added the comment: The current prompt works fine for me on zsh -- what's the bug here? zsh $ virtualenv venv --prompt '(wat)' Using real prefix '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7' New python executable in /private/tmp/venv/bin/python3.7

[issue35328] Set a environment variable for venv prompt

2018-11-27 Thread Baptiste Darthenay
Change by Baptiste Darthenay : -- keywords: +patch pull_requests: +9992 stage: -> patch review ___ Python tracker ___ ___

[issue35328] Set a environment variable for venv prompt

2018-11-27 Thread Baptiste Darthenay
=__VENV_PROMPT__ when activating the newly created venv, to be used by tools and other shells. -- messages: 330533 nosy: batisteo priority: normal severity: normal status: open title: Set a environment variable for venv prompt versions: Python 3.7, Python 3.8

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-12-01 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: I agree that this is not something that Popen should be doing. If you need the environment variable set, the correct thing to do is what you did: set it in the environment you pass to Popen. -- nosy: +r.david.murray priority

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-11-30 Thread Geoffrey Bache
Geoffrey Bache gjb1...@users.sourceforge.net added the comment: I tried that and it didn't work, though not for this reason. I'm also trying to read the output from the subprocess via a pipe and that wasn't being collected for some reason. I didn't really track down why so far, if it makes or

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-11-30 Thread Jean-Paul Calderone
Jean-Paul Calderone exar...@divmod.com added the comment: `Popen` is the wrong place to implement this functionality. It may be reasonable to introduce a higher-level wrapper API which does this sort of thing. Consider that if `Popen` itself does it, though, then there is no way to launch a

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-11-27 Thread Geoffrey Bache
Geoffrey Bache gjb1...@users.sourceforge.net added the comment: You misunderstand: I am not reading $PWD. I need to call a C program as a subprocess, which is written by a third party and which determines its current working directory by reading $PWD. os.chdir will not have any effect on this

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-11-27 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: What if you pass shell=True to the subprocess call? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4057 ___

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-11-26 Thread Geoffrey Bache
Changes by Geoffrey Bache gjb1...@users.sourceforge.net: -- nosy: +gjb1002 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4057 ___ ___

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-11-26 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: In most shells $PWD is a magic variable that is maintained by the shell itself. IMHO python has no reason to mess with variables that happen to be defined by some shells. If subprocess were to set $PWD, os.setuid should set $UID, and

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-11-26 Thread Geoffrey Bache
Geoffrey Bache gjb1...@users.sourceforge.net added the comment: I can see your point, though I think particularly in this case it's (unfortunately) fairly common that scripts on POSIX platforms read $PWD instead of finding the current working directory properly. I'm probably not the first

[issue4057] Popen(..., cwd=...) does not set PWD environment variable

2009-11-26 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: On 26 Nov, 2009, at 19:27, Geoffrey Bache wrote: Geoffrey Bache gjb1...@users.sourceforge.net added the comment: I can see your point, though I think particularly in this case it's (unfortunately) fairly common that scripts on

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: 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 only affect the current process and things

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 ``SetEnvironmentVariable``. Any

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 a ``GetEnvironmentVariable`` function

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 must be a

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's

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 while I

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 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 environment for

Re: Set an environment variable

2005-10-27 Thread Jorgen Grahn
On Wed, 26 Oct 2005 16:04:58 -0400, Mike Meyer [EMAIL PROTECTED] wrote: 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 only think

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 my experience, many people don't... True. Using Unix for 20+ years

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 is a child process Well, you know that, and I know that too.

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 only think you can export an environment variable to is a child process Well,

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 variable to a child process. Either of the lines of code above

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 probably warps one's perception of what's

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.sh

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 in

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 different

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 take

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 . /tmp/chgvars.sh

Re: Set an environment variable

2005-10-21 Thread Chris F.A. Johnson
On 2005-10-21, Christian wrote: 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

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] tmp]$ python one.py

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 two [EMAIL PROTECTED] tmp]$ python

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 Grant Edwards
.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://www.google.com/search?hl=enlr=q=python+set+environment+variable Follow the first hit. -- Grant Edwards grante

Re: Set an environment variable

2005-10-21 Thread Mike Meyer
://www.google.com/search?hl=enlr=q=python+set+environment+variable Follow the first hit. The first hit is basically the solution presented above translated from Unix to Windows: your python script writes the appropriate shell commands into a file, then you get the command processor to process that file

Re: Set an environment variable

2005-10-21 Thread Grant Edwards
=enlr=q=python+set+environment+variable Follow the first hit. My bad. I got links mixed up -- it wasn't the first one, it was this one: http://www.faqts.com/knowledge_base/view.phtml/aid/3298 There are two almost-equivalent tirival answers: os.environment['foo'] = 'bar' os.putenv('foo

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 to export a variable to a child

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's with all the shellular shenanigans? Actually, the OP

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

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 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 will only be visible in *this* process. Since

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, leaving the caller's environment

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 at

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 It's simpler

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