import os
print os.environ["USERNAME"]

L'ho testato sia su Linux che su WinXP