NickWaterton / Roomba980-Python

Python program and library to control iRobot Roomba 980 Vacuum Cleaner
MIT License
377 stars 106 forks source link

No handlers could be found for logger "roomba.__main__" #63

Open ncp1113 opened 4 years ago

ncp1113 commented 4 years ago

I am getting this error in testing the simple program example with Pyhton 2.7.16 on Debian Buster No handlers could be found for logger "roomba.main" Here is the test from roomba import Roomba

address = "192.168.1.1.." blid = "my blid" roombaPassword = "my password"

myroomba = Roomba(address, blid, roombaPassword)

import json, time for i in range(5): print json.dumps(myroomba.master_state, indent=2) time.sleep(1) myroomba.disconnect()`

NickWaterton commented 4 years ago

You need to create a logger called 'roomba', or at least a basic logger, eg:

import logging
log = logging.basicConfig(level=logging.DEBUG, 
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

before you create the Roomba instance.

This won't stop it working, it just means it can't log output as you haven't created a logging instance. Then instead of using print you uselog.info().