Thank you, Arebgun. 

> We probably shouldn't call it an error when the motor with certain id is not there, since the purpose of this script is to figure what is connected. 
What kind of error did you mention? 

In my case, the function
            if dxl_io.ping(idx):
returns false if the motor with certain id is not there and 
the program continue to other loop. 

When I executed the script by connecting a dynamixel motor which ID is 1,
I obtained these outputs:

$ rosrun dynamixel_driver scan_ids.py -p /dev/ttyUSB0
  Scanning 1... The motor 1 respond to a ping
  Scanning 2... ERROR: The specified motor did not respond to id 2.
  Scanning 3... ERROR: The specified motor did not respond to id 3.
  Scanning 4... ERROR: The specified motor did not respond to id 4.
  Scanning 5... ERROR: The specified motor did not respond to id 5.
  Scanning 6... ERROR: The specified motor did not respond to id 6.
  Scanning 7... ERROR: The specified motor did not respond to id 7.