(self, mount_list)
return mount_dict
Assign drive letters based on mount specification.
Assign drive letters based on mount specification.
Assign drive letters based on mount specification .
def _get_drives_from_list(self, mount_list):
        """Assign drive letters based on mount specification."""
        mount_dict = {}
        for spec in mount_list:
            # the last one that's specified will stick
            try:
                letter, path = spec.split(u':', 1)
                try:
                    letter = letter.encode('ascii').upper()
                except UnicodeError:
                    logging.error(u'Could not mount `%s`: invalid drive letter', spec)
                # take abspath first to ensure unicode, realpath gives bytes for u'.'
                path = os.path.realpath(os.path.abspath(path))
                if not os.path.isdir(path):
                    logging.error(u'Could not mount `%s`: not a directory', spec)
                else:
                    mount_dict[letter] = path
            except (TypeError, ValueError) as e:
                logging.error(u'Could not mount `%s`: %s', spec, e)
        return mount_dict
def _get_drives_from_list ( self , mount_list ) : mount_dict = { } for spec in mount_list : # the last one that's specified will stick try : letter , path = spec . split ( u':' , 1 ) try : letter = letter . encode ( 'ascii' ) . upper ( ) except UnicodeError : logging . error ( u'Could not mount `%s`: invalid drive letter' , spec ) # take abspath first to ensure unicode, realpath gives bytes for u'.' path = os . path . realpath ( os . path . abspath ( path ) ) if not os . path . isdir ( path ) : logging . error ( u'Could not mount `%s`: not a directory' , spec ) else : mount_dict [ letter ] = path except ( TypeError , ValueError ) as e : logging . error ( u'Could not mount `%s`: %s' , spec , e ) return mount_dict