PDA

View Full Version : [SOLVED] noob python question...



rlameiro
July 22nd, 2008, 01:21 PM
Hi everyone, I think that it is a noob question, but how can I know who is the user that runs the script? the idea is to save a file to the /home/user folder.

thanks

unutbu
July 22nd, 2008, 01:28 PM
#!/usr/bin/env python

import os
print os.environ['USER']
print os.environ['HOME']

rlameiro
July 22nd, 2008, 01:34 PM
Thanks unutbu :) I told it was a noob question....