Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix date object is None error. #731 #773

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

winkee01
Copy link

@winkee01 winkee01 commented May 23, 2021

As many people, including me, encounter this exception #731 all the time, I fix it by adding a check if the date object is None before it is processed. This bug is caused by dateparser library failed to parse the date on certain machine (may not related to a specific python3 version)

@winkee01 winkee01 changed the title fix date None error. #731 fix date object None error. #731 May 23, 2021
@winkee01 winkee01 changed the title fix date object None error. #731 fix date object is None error. #731 May 23, 2021
@creamsoup
Copy link

just out of curiosity can you provide the failed date or better log file name that causes this issue?

@winkee01
Copy link
Author

just out of curiosity can you provide the failed date or better log file name that causes this issue?

It might not caused by a specific date but the OS? because I tested on another machine, and the dateparser works fine.

Below is my OS that dateparser failed to work

  • operating system
$ lsb_release -a
LSB Version:	core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 20.10
Release:	20.10
  • python
python --version
Python 3.8.6

Codename: groovy

@winkee01
Copy link
Author

I tested on macOS and another ubuntu machine, dateparser works without problem

lsb_release -a
LSB Version:	core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.2 LTS
Release:	20.04
Codename:	focal

python 3.8.5

@creamsoup
Copy link

hmm chiapos is using ctime() to print. ctime is using format "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n".
we could parse using that format to parse assuming ctime() result is same. if it can vary (i am not c++ person nor python =p) we will have another format to consider.

dateparser is using locale so that could be the root cause. with the provided format, we won't be system dependent. if this seems too risky, we could always fallback to current behavior.

the real problem is parsing logic, so i would rather spend time on parsing logic than trying to guess the date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants