def update_from_console(self):
        config = self.find_connection_info(self._host, self._port, self._db)
        
        if config is None:
            # the problem here is if VisTrails is being run through command
            # line from LaTex, stdout is being redirected to a log file, so
            # the user does not see the prompt in raw_input. getpass uses the 
            # controlling terminal so it works fine. Just to make sure he sees 
            # the first message prompt we will the controlling terminal
            try:
                f= open('/dev/tty', 'w')
                f.write("\nConnect to db with username [%s]: "%self._user)
                f.close()
                user = raw_input()
            except __HOLE__:
                debug.warning("Couldn't write to terminal. Will try stdout")
                user = raw_input("Connecting to db with username[%s]: "%self._user)
            try:
                if user != '':
                    self._user = user
                passwd = getpass.getpass("password:")
                self._passwd = passwd
                config = {'host': self._host,
                          'port': int(self._port),
                          'user': self._user,
                          'passwd': self._passwd,
                          'db': self._db
                          }
                test_db_connection(config)
                config['succeeded'] = True
                config['name'] = '%s@%s'%(self._user,self._host)
                config['id'] = -1
            except VistrailsDBException, e:
                debug.critical('VisTrails DB Exception',  e)
                config['succeeded'] = False
            except Exception, e2:
                debug.critical('VisTrails Exception', e2)
                config['succeeded'] = False
        if config is not None:
            if config['succeeded'] == False:
                passwd = getpass.getpass("\nVisTrails DB password for user %s:"%config['user'])
                self._user = config['user']
                self._passwd = passwd
                dbconfig = {'host': self._host,
                          'port': int(self._port),
                          'user': self._user,
                          'passwd': self._passwd,
                          'db': self._db
                          }
                try:
                    test_db_connection(dbconfig)
                    config['succeeded'] = True
                    config['passwd'] = self._passwd
                except VistrailsDBException, e:
                    debug.critical('VisTrails DB Exception', e)
                    config['succeeded'] = False
            
            if config['succeeded'] == True:
                self._host = config['host']
                self._port = config['port']
                self._db = config['db']
                self._user = config['user']
                self._passwd = config['passwd']
                self.ext_connection_id = self.set_connection_info(**config)
                return True
            return False
        return False
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/db/locator.py/DBLocator.update_from_console