X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Farchitecture.py;h=7d66a03d96c31fca332b525691f28987e1561ecc;hb=46f6029af905d76f63468622e56ddcb8fa4a8c59;hp=5b8711b4a05d3e87e2a519da7fa767a3d00e8a66;hpb=1cb97ddd3ce3e6c17e74db6a4772c38a1ebd2115;p=tools%2Fsat.git diff --git a/src/architecture.py b/src/architecture.py index 5b8711b..7d66a03 100644 --- a/src/architecture.py +++ b/src/architecture.py @@ -35,16 +35,18 @@ def get_user(): :rtype: str ''' - # In windows case, the USERNAME environment variable has to be set - if is_windows(): - if not 'USERNAME' in os.environ: - raise Exception('USERNAME environment variable not set') - return os.environ['USERNAME'] - else: # linux - import pwd - return pwd.getpwuid(os.getuid())[0] - + try : + if is_windows(): + # In windows case, the USERNAME environment variable has to be set + user_name=os.environ['USERNAME'] + else: # linux + import pwd + user_name=pwd.getpwuid(os.getuid())[0] + except : + user_name="Unknown" + return user_name + def get_distribution(codes): '''Gets the code for the distribution @@ -54,7 +56,7 @@ def get_distribution(codes): :rtype: str ''' if is_windows(): - return "Win" + return "W" # else get linux distribution description from platform, and encode it with code lin_distrib = platform.dist()[0].lower()