sandsturm / whatsapp-converter

Use this application to convert your exported WhatsApp chat to a CSV, Excel or ODS file.
MIT License
17 stars 8 forks source link

ValueError: time data '11/12/17' does not match format '%m/%d/%Y' #11

Closed PandaSekh closed 2 years ago

PandaSekh commented 2 years ago

Hi,

i installed the package with pip but it's throwing that error when running like this: whatsapp-converter _chat.txt

The messages are formatted as follows: [11/12/17, 17:37:48] user: message

The error is: Traceback (most recent call last): File "/Users/alessio/opt/miniconda3/bin/whatsapp-converter", line 33, in <module> sys.exit(load_entry_point('whatsapp-converter==0.5.4', 'console_scripts', 'whatsapp-converter')()) File "/Users/alessio/opt/miniconda3/lib/python3.9/site-packages/whatsapp_converter/__main__.py", line 60, in main whatsapp_converter.convert(args) File "/Users/alessio/opt/miniconda3/lib/python3.9/site-packages/whatsapp_converter/whatsapp_converter.py", line 219, in convert buffer = parse(line, local_args) File "/Users/alessio/opt/miniconda3/lib/python3.9/site-packages/whatsapp_converter/whatsapp_converter.py", line 97, in parse date = datetime.datetime.strptime(match.group(1), "%m/%d/%Y").date() File "/Users/alessio/opt/miniconda3/lib/python3.9/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/Users/alessio/opt/miniconda3/lib/python3.9/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '11/12/17' does not match format '%m/%d/%Y'

Thanks

sandsturm commented 2 years ago

Hi, can you please send my an anonymized part of the chat, e.g. 5 to 10 messages with the format causing the issues? I take a look at it.

Best regards, Martin

PandaSekh commented 2 years ago

Please find an example attached.

example.txt

sandsturm commented 2 years ago

Thanks a lot. Apart from the error which is related to the year, is your date format month/day or day/month? Your provided example is not clear on that.

Thanks, Martin

PandaSekh commented 2 years ago

You're right, sorry. It's day/month

sandsturm commented 2 years ago

I updated the package to version 0.5.7. I did a quick fix, but your issue made me think of the architecture. I will rework the architecture in a next version to better deal with such kind of bugs.

Please install the latest version. Maybe use pip install whatsapp-converter==0.5.7

Can you please post your feedback here if it works now?

Cheers, Martin

PandaSekh commented 2 years ago

Thank you, now it's working!