[Tutor] accessing another system's environment

Steve Willoughby steve at alchemy.com
Sat Feb 26 10:40:12 CET 2011


On 26-Feb-11 01:19, ALAN GAULD wrote:
> Bill,
>
> That's the same thing we are talking about.
> The problem is those environment variables are
> highly variable so you can't talk about a machine's environment.
> Two users on the same machine (at the same time) may have
> very different environments. And a batch file or program can

I'm a Unix hacker, so forgive me if my understanding of Windows is a bit 
naive.  I think, though, that Windows has a set of environment variables 
which are system-wide, added automatically to the user set of variables 
when a new process is launched.  Yes, they can be changed or deleted but 
there is a standard set applied to all users.

If that's a correct assumption on my part, there must be somewhere that 
can be read from, probably (I would guess) in the registry.  So a script 
which could read/write those registry keys may do what is required here.

The issue of exposing that to remote machines remains a dangling issue, 
though.

Of course, it's not entirely clear we're solving a Python question, 
although this discussion may well go more solidly into that space.

> add or remove variables too. So when I run python2 I may have
> the PYTHONPATH seet to one thing, but if I run python3 I
> have it set to something different. And I could be running
> both at the same time. And another user (or service) logged
> into the same machine might be running a Django web server with
> yet another setting. So what is PYTHONPATH for that "machine"?
>
> The USER and HOME Values are set by the OS to different
> values depending on who is logged in, but the user can
> then change these later, etc...
>
> Even with no users logged in you might have different services
> running each with their own environment set up.
>
> It is very difficult for an admin to do anything reliably
> based on environment variable settings.
>
> Alan Gauld
> Author of the Learn To Program website
> http://www.alan-g.me.uk/
> <http://www.alan-g.me.uk>
>
>
>     *From:* Bill Allen <wallenpb at gmail.com>
>     *To:* Alan Gauld <alan.gauld at btinternet.com>
>     *Cc:* tutor at python.org
>     *Sent:* Saturday, 26 February, 2011 2:50:39
>     *Subject:* Re: [Tutor] accessing another system's environment
>
>     I apologize for not have been clear previously. What I am trying to
>     access are the Windows system environment variables. The same ones
>     that are listed out if you type the set command at a command prompt
>     in Windows.
>
>
>     --Bill
>
>
>
>
>
>     On Fri, Feb 25, 2011 at 03:11, Alan Gauld <alan.gauld at btinternet.com
>     <mailto:alan.gauld at btinternet.com>> wrote:
>
>
>         "Bill Allen" <wallenpb at gmail.com <mailto:wallenpb at gmail.com>> wrote
>
>             I have times when it is useful for me to check the
>             environment of a user
>             system on our lan remotely while trouble shooting and issue
>             with them. Now,
>             this is quite easy to do while I am using a windows system
>             via the computer
>             management console.
>
>
>         I think we are meaning different things by "environment"?
>         Can you give a specific example?
>
>
>             However, I am trying to do this via a linux workstation
>             (which is joined to the domain, etc.). I cannot find a native
>             facility to duplicate the computer management functions, so
>             I thought I
>             would write a program to fill the need.
>
>
>         Anything you can do locally you can do on the remote
>         machine with a combination of ssh, rsh, rlogin, telnet etc.
>         ssh is the safest but requires a bit more admin to set it
>         up properly for maximum convenience.
>
>         Having got remote access its just a case of figuring out
>         which of the 500 or so Unix commands you need to
>         use to do the job... :-)
>
>
>         HTH,
>
>         --
>         Alan Gauld
>         Author of the Learn to Program web site
>         http://www.alan-g.me.uk/
>
>
>         _______________________________________________
>         Tutor maillist - Tutor at python.org <mailto:Tutor at python.org>
>         To unsubscribe or change subscription options:
>         http://mail.python.org/mailman/listinfo/tutor
>
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor


-- 
Steve Willoughby / steve at alchemy.com
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53


More information about the Tutor mailing list