j4321 / tkcalendar

Calendar widget for Tkinter
https://pypi.python.org/pypi/tkcalendar
GNU General Public License v3.0
99 stars 33 forks source link

DateEntry dropdown not work on Python 3.6.5 with tkcalendar 1.2.1 #17

Open mottymu opened 6 years ago

mottymu commented 6 years ago

I use Windows10 with Python 3.6.5 and tkcalendar 1.2.1

when I use DateEntry() and click on dropdown button it nothing happen and got this error

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python36-64\lib\tkinter\__init__.py", line 1702, in __call__
    return self.func(*args)
  File "C:\Python36-64\lib\site-packages\tkcalendar.py", line 895, in _on_b1_press
    self.drop_down()
  File "C:\Python36-64\lib\site-packages\tkcalendar.py", line 967, in drop_down
    self._validate_date()
  File "C:\Python36-64\lib\site-packages\tkcalendar.py", line 926, in _validate_date
    self._date = self._calendar.strptime(self.get(), '%x').date()
  File "C:\Python36-64\lib\_strptime.py", line 565, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "C:\Python36-64\lib\_strptime.py", line 345, in _strptime
    format_regex = _TimeRE_cache.compile(format)
  File "C:\Python36-64\lib\_strptime.py", line 275, in compile
    return re_compile(self.pattern(format), IGNORECASE)
  File "C:\Python36-64\lib\re.py", line 233, in compile
    return _compile(pattern, flags)
  File "C:\Python36-64\lib\re.py", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "C:\Python36-64\lib\sre_compile.py", line 562, in compile
    p = sre_parse.parse(p, flags)
  File "C:\Python36-64\lib\sre_parse.py", line 855, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "C:\Python36-64\lib\sre_parse.py", line 416, in _parse_sub
    not nested and not items))
  File "C:\Python36-64\lib\sre_parse.py", line 759, in _parse
    raise source.error(err.msg, len(name) + 1) from None
sre_constants.error: redefinition of group name 'w' as group 4; was group 3 at position 87

what I have to do?

Thank you.

j4321 commented 6 years ago

Can you tell me what is written in the Entry when you try to open the calendar? Seems like the error comes from strptime, so can you also tell me if the following code works for you?

import datetime
today = datetime.datetime.today().strftime('%x')
print(datetime.datetime.strptime(today, '%x').date())

I am working on a way to avoid using strptime so maybe it will solve your issue, I will let you know when the code is ready so that you can test it.

mottymu commented 6 years ago

It's work fine with your code

import datetime today = datetime.datetime.today().strftime('%x') print(datetime.datetime.strptime(today, '%x').date())

the result is

2018-08-08 Process finished with exit code 0

j4321 commented 6 years ago

Ok, thanks for the feedback, right now I have no idea what is causing your issue. Can you give me a full snippet of code that reproduces the error you got and tell me how you ran it (python console, IDLE, ...)?

j4321 commented 6 years ago

Could you try this version of the code and tell me if you still have the error?

mottymu commented 6 years ago

I tried to use Python 3.4/3.6.5/3.7 and my IDE are Pycharm Pro and Sublime text 3 all of them got the same error.

And link that you post I can't download. Could you post new link?

j4321 commented 6 years ago

Ok, sorry about the download link, I merged the branch with master and deleted it. You can now directly try the code from the master branch.

I had feedback from another Windows user for whom everything works fine and I also use Appveyor to run tests on Windows (with python 2.7, 3.4, 3.5 and 3.6), so I really have no clue why this i not working for you. I hope that using babel module (needs to be installed) will solve your issue.