Python Django运行时错误列表索引器macOS到Windows

Python Django运行时错误列表索引器macOS到Windows,python,django,index-error,Python,Django,Index Error,我和我的团队在一个Django项目上工作,我们遇到了一个问题。所以我们两个人,包括我在内,正在研究macOS。我们的代码在macOS上运行得很好,我们在git上推广了它。但是其他在windows上工作的人得到了一个列表索引超出范围的错误。每个人都有相同的版本。是不是因为macOS和windows有不同的库 def getStand(self, getränk): with open("machine/Lagerverwaltung.csv", "r") as file: r

我和我的团队在一个Django项目上工作,我们遇到了一个问题。所以我们两个人,包括我在内,正在研究macOS。我们的代码在macOS上运行得很好,我们在git上推广了它。但是其他在windows上工作的人得到了一个列表索引超出范围的错误。每个人都有相同的版本。是不是因为macOS和windows有不同的库

def getStand(self, getränk):
    with open("machine/Lagerverwaltung.csv", "r") as file:
       reader = csv.reader(file)
       next(reader)
       count = 0
       for line in reader:
            count += 1
            if count == getränk:
                return float(line[2])
            else:
                continue
回溯:

Watching for file changes with StatReloader
Internal Server Error: /
Traceback (most recent call last):
File "C:\Users\-\AppData\Local\Programs\Python\Python38\lib\site- 
packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\-\AppData\Local\Programs\Python\Python38\lib\site- 
packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\-\AppData\Local\Programs\Python\Python38\lib\site- 
packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\-\Desktop\vending\vendingmachine\machine\views.py", line 17, in main
context = {"cola": l.getStand(1), "fanta": l.getStand(2), "sprite": l.getStand(3), "pepsi": 
l.getStand(4), "limit": l.literLimit}
File "C:\Users\-\Desktop\vending\vendingmachine\machine\views.py", line 154, in getStand
return float(line[2])
IndexError: list index out of range
[14/Jun/2020 12:45:56] "GET / HTTP/1.1" 500 77982

也许打印
reader
会对您有所帮助。csv文件的格式可能不同,或者macos和windows上的默认预期格式可能不同。您能推荐一些解决方法吗?谢谢各位,我发现了错误