Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

In Windows, don't echo out "SET ..." commands, instead set environment variables from within Python #233

Open
gene1wood opened this issue Aug 6, 2020 · 4 comments

Comments

@gene1wood
Copy link
Contributor

Since there's no easy way to eval in cmd.exe instead of outputting SET AWS_.... just set the environment variables inside Python (shutil.command("setx foo=bar")).

This adds them to the global OS wise environment variable namespace. It doesn't however update the current cmd.exe that you're in.

@gene1wood gene1wood changed the title In WIndows, don't echo out "SET ..." commands, instead set environment variables from within Python In Windows, don't echo out "SET ..." commands, instead set environment variables from within Python Aug 6, 2020
@april
Copy link
Contributor

april commented Aug 6, 2020

Is this actually the right thing to do, though? I'm not certain if this is a good idea, or if we should simply tell people that only awscli and envvar as text output works in a cmd terminal.

@gene1wood
Copy link
Contributor Author

I think we can make it an option for users. We can even echo out from maws (in windows) something like "your environment has been update. this cmd.exe window however has not"

I don't think the "print something out and expect the user to copy paste it back into their console" is a path we want to offer

@april
Copy link
Contributor

april commented Aug 6, 2020

Yes, but that's a considerable amount of work for a small group of people clinging to an ancient subsystem. I almost think it would be better to simply say to use Powershell instead.

@april
Copy link
Contributor

april commented Aug 6, 2020

And even if we did do it, the best case scenario is that you have to close your existing window and open a new command window. That is pretty darned ugly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants