Help appreciated. This is the error i get after executing the code. i use openpyxl 3.0.3 [closed]

asked 2020-03-03 00:25:33 -0500

VigneshSuresh gravatar image

updated 2020-03-03 07:49:26 -0500

supra56 gravatar image

Code:

for row in range(2, (len(sheet.columns[0]) + 1)):
    rno = sheet.cell('A%s'% row).value
    if rno is not None:
        rno = rno[-2:]
        if attend[int(rno)] != 0:
            col = getDateColumns()
            sheet['%s%s' % (col, str(row))]=1

The Error i get is:-

Enter Subject: SQA
Success
Frame2. 1 face detected and 0 faces recognized
Traceback (most recent call last):
  File "C:\Users\ACER\Desktop\PROJECT ALL RESOURCE\PROJECT ALL RESOURCE\Implementation\PYTHON FILES\facerecognition.py", line 92, in <module>
    for row in range(2, (len(sheet.columns[0]) + 1)):
TypeError: 'generator' object is not subscriptable
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2020-03-03 01:41:55.983247

Comments

The sheet.columns is generator. So use list, next, np.float, itertools, np.array etc. It should be like this for row in range(2, (list(sheet.columns)[0] + 1)):I cannot test it for you because you're using older version 3.0.3

supra56 gravatar imagesupra56 ( 2020-03-03 07:55:22 -0500 )edit
1

Sir, the pypi.org also says openpyxl latest version is 3.0.3 and you say it is oldest. If yes, please tell from where shall I download the new version

VigneshSuresh gravatar imageVigneshSuresh ( 2020-03-03 10:26:32 -0500 )edit

Here is link( OpenCV 4.2.0

supra56 gravatar imagesupra56 ( 2020-03-03 11:08:44 -0500 )edit
1

OpenCV is 4.2.0 which I use. I use openpyxl 3.3.0 which is latest version

VigneshSuresh gravatar imageVigneshSuresh ( 2020-03-03 21:41:29 -0500 )edit

I am not familiar with openpyxl 3.3.0.

supra56 gravatar imagesupra56 ( 2020-03-05 20:44:41 -0500 )edit