Re: Python doesn't understand %userprofile%



On Jun 11, 1:58 am, Tim Roberts <t...@xxxxxxxxx> wrote:
bsag...@xxxxxxxxx wrote:

In xp when I try os.path.getmtime("%userprofile/dir/file%") Python
bites back with "cannot find the path specified" Since my script has
to run on machines where the username is unspecified I need a fix.

For the record, the %PERCENT% syntax for looking up an environment variable
is just a feature of the XP command shell.  It has no meaning to any other
part of Windows.

os.environ is the right answer.
--
Tim Roberts, t...@xxxxxxxxx
Providenza & Boekelheide, Inc.


You can use it at the Run command or in Explorer too. If I type
%username% in either place, it opens the following on my XP machine: C:
\Documents and Settings\Mike

Mike
.



Relevant Pages

  • Re: disabling password request when connecting from the LAN
    ... There is no "fix" - this is Windows security working as it is supposed to. ... In the absence of a domain controller to provide access control lists to ... One of the machines on my LAN is running Win2k Pro. ... > of other OSes) it always asks me for a username and password before ...
    (microsoft.public.win2000.networking)
  • Re: Python doesnt understand %userprofile%
    ... bites back with "cannot find the path specified" Since my script has ... to run on machines where the username is unspecified I need a fix. ...
    (comp.lang.python)
  • Re: Python doesnt understand %userprofile%
    ... bites back with "cannot find the path specified" Since my script has ... to run on machines where the username is unspecified I need a fix. ...
    (comp.lang.python)
  • Python doesnt understand %userprofile%
    ... bites back with "cannot find the path specified" Since my script has ... to run on machines where the username is unspecified I need a fix. ...
    (comp.lang.python)
  • Re: NT4 Disallow multiple logins
    ... >> school and my client base comprises primarily of Students.) ... > specify access times and logon machines this ... > will allow the logon *only* in the defined time ... in 20 times by passing his username and password to 19 other students? ...
    (microsoft.public.security)