Tim Chase
2/11/2008 7:36:00 PM
> Can anyone tell me how to find current working user in windows?
The below should be fairly cross-platform:
>>> import getpass
>>> whoami = getpass.getuser()
>>> print whoami
W: tchase
L: tim
("W:" is the result on my windows box, "L:" is the result on my
Linux box) which can be used in concert with
>>> import user
>>> print user.home
W: C:\Documents and Settings\tchase
L: /home/tim
or
>>> import os
>>> os.expanduser('~/Desktop')
W: C:\Documents and Settings\tchase/Desktop
L: /home/tim/Desktop
in case you need either of them.
-tkc