0

I am currently reading a csv in Python and writing to it. I have it running on an ec2 server but I do the development on my local windows laptop before pushing updates. I recently got the following error:[Errno 5] Input/output error, but it only occurs on the ec2 server. The code runs fine on my local windows laptop. Additionally, it says that it is an OS error. Here's the part of the code causing the problem:

        with open(filename, 'rt') as f:
            reader = csv.reader(f, delimiter=',')
            lines = []
            if sum(1 for row in reader) < len(players):
                f.seek(0)
                for row in reader:
                    row_len = len(row)
                line = []
                for i in range(row_len):
                    line.append('')
                f.seek(0)
                for i in range(len(players) + 1 - sum(1 for row in reader)):
                    lines.append(line)
            f.seek(0)
            title = next(reader)
            counter = 0
            for line in reader:
                lines.insert(0, line)

I can include surrounding code if it would be useful. The error says the problem occurs on the very first line in the code above. Why would I be getting this error on my ec2 Ubuntu server but not on my local windows machine?

bballboy8
  • 400
  • 6
  • 25

0 Answers0