LKI / chinese-calendar

判断一天是不是法定节假日/法定工作日(查看节假日安排)
https://pypi.org/project/chinesecalendar/
MIT License
1.06k stars 185 forks source link

python 2.7,提示出错AttributeError: 'tuple' object has no attribute 'value' #78

Closed linlone closed 2 years ago

linlone commented 2 years ago

我在windows下,执行下面的命令,python是2.7,提示出错AttributeError: 'tuple' object has no attribute 'value',这是为啥呢?

D:\temp>python -V Python 2.7.18

D:\temp> D:\temp>type test.py import datetime from chinese_calendar import is_workday

date = datetime.datetime.now().date() if is_workday(date): print("work day") else: print("holidy day")

D:\temp> D:\temp>python test.py Traceback (most recent call last): File "test.py", line 4, in from chinese_calendar import is_workday File "C:\Python27\lib\site-packages\chinese_calendar__init__.py", line 4, in from .constants import Holiday, holidays, in_lieu_days, workdays File "C:\Python27\lib\site-packages\chinese_calendar\constants.py", line 31, in datetime.date(year=2004, month=1, day=1): Holiday.new_years_day.value, AttributeError: 'tuple' object has no attribute 'value'

LKI commented 2 years ago

目前已经不支持 py27 了~

(这个报错看起来可能是 enum 的问题,可以尝试通过 pip install enum34 来兼容,不过可能还会有其它报错~