: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_windows_os_label():
- '''returns the SAT convention used for Windows labeling '''
- return "W" # in order to fulfill the 8196 length constraint!
def get_distribution(codes):
'''Gets the code for the distribution
:rtype: str
'''
if is_windows():
- return get_windows_os_label()
+ return "W"
# else get linux distribution description from platform, and encode it with code
lin_distrib = platform.dist()[0].lower()