Pi上的索引超出范围但笔记本电脑上没有

时间:2016-03-08 22:06:47

标签: python raspberry-pi raspbian-wheezy

我编写了一个可以在我的笔记本电脑上运行的程序(Ubuntu 14.1 with Python 2.7.6),但是在raspberry pi(Wheezy w / Python 2.7.3)上不起作用。我得到一个索引:在笔记本电脑上运行时不会出现的Pi超出范围错误。

flash.py

def bang(self, dev):

        self.makers = g.get_csv_values()
        self.ma =()
        self.ma = g.id_hub(self.makers)
        #print self.ma
        self.make = self.ma[0]
        self.dex = self.ma[1]
        self.dfu = g.get_dfu(self.make, self.dex) //Here's the call
        self.hub_name = g.get_product_name(self.make, self.dex)

        if self.hub_name is None:
            self.mod.text = 'No hub found'
            self.prm.text = 'Reconnect hub'
            Clock.schedule_interval(self.detect, 1)
        else:

            self.mod.text = self.hub_name + ' hub found'
            self.prm.text = 'Testing...'


        self.err_comp = g.flash_hub(self.dfu)

        if self.err_comp == 'Error':
            self.prm.text = 'Error: Reflash'
            #Clock.schedule_interval(self.detach, 1)
        if self.err_comp == 'Completed':
            self.prm.text = 'Flashing Done!'
            time.sleep(3)
            Clock.schedule_interval(self.detach, 2)

getters.py

def id_hub(args):

    hub = subprocess.check_output('sudo lsusb | grep 2996', shell=True)
    vends = []
    vends = [hub[28:32], hub[63:67], hub[98:102]]

    for i in vends:
        a = '0x' + i
        if a in args[0]['Hub_idProduct']:
            gm = args[0], args[0]['Hub_idProduct'].index(a)
            return gm 
        elif a in args[1]['Hub_idProduct']:
            ford = args[1], args[1]['Hub_idProduct'].index(a)
            return ford 
        elif a in args[2]['Hub_idProduct']:
            chrysler = args[2], args[2]['Hub_idProduct'].index(a)
            return chrysler




def get_dfu(make, dex):
    #print make
    #print dex
    return make['dfu'][dex] //Here is the line indicated in the error
在我正在测试的2个案例中

self.ma

0 个答案:

没有答案