0

I have a problem with the code in the line 62 and i dont know how to fix this, its the first time i recive this error. Seems that is not well identated but i think it was. Is in the line with 'mes = lista_meses[tempNumMes-1]'

views.py

def crear_pdf(request):
    fecha = datetime.date.today()

    tempNumMes = fecha.month
    year = fecha.year


    lista_meses = ["Enero"
            , "Febrero"
            , "Marzo"
            , "Abril"
            , "Mayo"
            , "Junio"
            , "Julio"
            , "Agosto"
            , "Septiembre"
            , "Octubre"
            , "Noviembre"
            , "Diciembre"]


    mes = lista_meses[tempNumMes -1]



    return render(request,'pdf_creado.html')
Eric Cano
  • 21
  • 6
  • 3
    You at least need to tell us what line 62 is. Even better, cut down your code to the minimum necessary to show the problem. – Daniel Roseman May 22 '17 at 09:11
  • Sorrry thats true its in the line mes = lista_meses[tempNumMes - 1] – Eric Cano May 22 '17 at 09:13
  • Check this SO about fixing indentation issues: http://stackoverflow.com/questions/1024435/how-to-fix-python-indentation – Sohaib Farooqi May 22 '17 at 09:15
  • Might be a tab versus spaces problem. The code as it is in the question, up to and including the offending line, is fine (from copy-paste testing). –  May 22 '17 at 09:16
  • Yes is pasted from a function that i write before. If this is the problem how can i fix it?¿ – Eric Cano May 22 '17 at 09:32
  • As the guys previously indicated try using just spaces or tabs for indentation but not both at the same time, even though python 2.7 allows this. You should also consider working with an IDES such Pycharm which will show you this error immediately. – Pablo Fernandez May 22 '17 at 11:31

1 Answers1

0

The error is pretty straightforward : you have an indentation error here, do you use space instead of tab ? If that the case use tab (4 spaces) in your IDE config. And just Re-indent your code it will work :)

MaximeK
  • 2,039
  • 1
  • 10
  • 16