scrapinghub / scrapinghub/dateparser

dateparser.parse only returns NoneType object when using AWS EC2 (Running Python 3.7.9)

Open
#857 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
520
Avg merge
22h 56m
Merged PRs (30d)
6

Description

Running the following simple code works just fine on my local machine running Python 3.7.3, but returns only object type None when running the same file on an AWS EC2 instance running Python 3.7.9. Any thoughts what could be going on?

Script:

#!/usr/bin/env python
import dateparser

date1 = '2020-01-01'
date2 = '12/13/2020'
date3 = 'December 15, 2020'
date4 = 'Saturday, Dec 12'
date5 = '12-12-2020'
date1p = dateparser.parse(date1)
date2p = dateparser.parse(date2)
date3p = dateparser.parse(date3)
date4p = dateparser.parse(date4)
date5p = dateparser.parse(date5)
print("Date 1 Original:", date1)
print("Date 1 Parsed:", date1p)
print("Date 2 Original:", date2)
print("Date 2 Parsed:", date2p)
print("Date 3 Original:", date3)
print("Date 3 Parsed:", date3p)
print("Date 4 Original:", date4)
print("Date 4 Parsed:", date4p)
print("Date 5 Original:", date5)
print("Date 5 Parsed:", date5p)

Output on local machine running 3.7.3:

Date 1 Original: 2020-01-01
Date 1 Parsed: 2020-01-01 00:00:00
Date 2 Original: 12/13/2020
Date 2 Parsed: 2020-12-13 00:00:00
Date 3 Original: December 15, 2020
Date 3 Parsed: 2020-12-15 00:00:00
Date 4 Original: Saturday, Dec 12
Date 4 Parsed: 2020-12-12 00:00:00
Date 5 Original: 12-12-2020
Date 5 Parsed: 2020-12-12 00:00:00

Output on EC2 with 3.7.9:

Date 1 Original: 2020-01-01
Date 1 Parsed: None
Date 2 Original: 12/13/2020
Date 2 Parsed: None
Date 3 Original: December 15, 2020
Date 3 Parsed: None
Date 4 Original: Saturday, Dec 12
Date 4 Parsed: None
Date 5 Original: 12-12-2020
Date 5 Parsed: None

Any ideas?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided script with dateparser on Python 3.7.3 and 3.7.9, comparing the local environment with the AWS EC2 environment. Investigate why every dateparser.parse call returns None on EC2; done means the five sample inputs produce parsed dates consistently across the reported environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.