Python - Problema con calendar de python - AttributeError: module 'calendar' has no attribute 'month'

 
Vista:

Problema con calendar de python - AttributeError: module 'calendar' has no attribute 'month'

Publicado por frander (2 intervenciones) el 13/05/2016 20:50:00
1
2
3
4
5
6
Traceback (most recent call last):
  File "C:/Users/Frander/Desktop/calendar.py", line 5, in <module>
    import calendar
  File "C:/Users/Frander/Desktop\calendar.py", line 16, in <module>
    cal = calendar.month(2016,mes)   #4
AttributeError: module 'calendar' has no attribute 'month'

me caga este error, pasa al ejecutar esto


1
2
3
4
5
6
7
8
9
10
11
12
13
14
import datetime
import calendar
 
 
mes=datetime.date.today().month
 
 
if mes >=1 and mes <=12:              #3
    cal = calendar.month(2016,mes)   #4
    print ("Esse é o Calendário do mês",mes)
    print ('--------------------------------')  #5
    print (cal)#6
else:
    print ('Intrada invalida')         #7
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 2.239
Plata
Ha mantenido su posición en Python (en relación al último mes)
Gráfica de Python

Problema con calendar de python - AttributeError: module 'calendar' has no attribute 'month'

Publicado por xve (1646 intervenciones) el 14/05/2016 08:22:07
Hola Frander, he probado tu código y me ha funcionado perfectamente con Python 3.x...
1
2
3
4
5
6
7
8
9
10
11
$ python3 x.py
Esse é o Calendário do mês 5
--------------------------------
      May 2016
Mo Tu We Th Fr Sa Su
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

Prueba a cambiar el nombre del archivo "calendar.py", ya que se llama igual que la librería que quieres cargar, y seguramente te carga tu archivo en vez de la librería...

Coméntanos, ok?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar