python serial error raspberry-pi gps module
Question: I am trying to use python serial (for python 2.7) to read data from a gps
device (ublox EVK-7P). I am using the following code:

    
    
    #!/usr/bin/env python
    #-*- coding: utf-8 -*-
    import time
    import serial
    ser = serial.Serial('/dev/ttyUSB7', 9600, timeout = 5)
    ser.open()
    while True:
        print ser.readline()
    

The following error comes up when I try to run the program-

    
    
    File "./gps2.py", line 7, in <module>
    ser = serial.Serial('/dev/ttyUSB7',9600,timeout = 5)
      File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 260, in     __init__
        self.open()
      File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 276, in open
       raise SerialException("could not open port %s: %s" % (self._port, msg))
    serial.serialutil.SerialException: could not open port /dev/ttyUSB7: [Errno 2] No such file or directory: '/dev/ttyUSB7'
    

Out of curiosity I used 'sudo lsusb' in the terminal. I got the following:

    
    
    Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
    Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
    Bus 001 Device 005: ID 062a:0201 Creative Labs Defender Office Keyboard     (K7310) S Zodiak KM-9010
    Bus 001 Device 006: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
    Bus 001 Device 007: ID 1546:01a7 U-Blox AG 
    

Could anyone please help me out? Please tell me what am I doing wrong. I'm
using an external mouse and keyboard and plugged another usb drive into the pi
(all done using a 4-to-1 usb connector plugged to the pi).

Thanks


Answer: Using `dmsg` after plugging you HW will give you the correct /dev device to
use. You can check that it exists : `ls -lsah /dev/ttyUSB*` and that your user
has the correct permission to use it.

