import parsedatetime as pdt
c = pdt.Constants();c.BirthdayEpoch = 80 # if parsed year value is less than this value set to 2000+ valuep = pdt.Calendar(c)
>>> print p.parseDate("PRESENT: Mayor M. Connie Castaeda, Trustee William G. Andrews, Trustee Margaret B. Blackman, ")Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/home/administrator/.virtualenvs/mmenv/local/lib/python2.7/site-packages/parsedatetime/__init__.py", line 356, in parseDatev1 = int(s[:index])ValueError: invalid literal for int() with base 10: 'PRESENT: Mayor M'
>>> print p.parseDateText("PRESENT: Mayor M. Connie Castaeda, Trustee William G. Andrews, Trustee Margaret B. Blackman, ")(2013, 5, 1, 23, 10, 15, 5, 68, 0)
>>> print p.parseDateText("Fluffy is cute.")Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/home/administrator/.virtualenvs/mmenv/local/lib/python2.7/site-packages/parsedatetime/__init__.py", line 427, in parseDateTextmth = m.group('mthname')AttributeError: 'NoneType' object has no attribute 'group'
>>> print p.parseDateText("I took my cat sniffles to the market with me.")(2014, 3, 1, 23, 17, 57, 5, 68, 0)
--
You received this message because you are subscribed to the Google Groups "parsedatetime-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to parsedatetime-...@googlegroups.com.
To post to this group, send email to parsedat...@googlegroups.com.
Visit this group at http://groups.google.com/group/parsedatetime-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Bear,Thanks so much for your reply. It looks like I am using the library incorrectly then. I have many lines of text that only one contains a valid date (in some form that parsedatetime *does* recognize). My problem is that I need to know if a date exists within the text first, before sending it to the parse() function.
Thoughts on any tricks to perform that function and return Boolean of valid or not?
Thanks again for the quick response Bear. In the SO question, I provided the example here:
print p.parse("Mary had a little lamb.")
Which returns:
((2014, 3, 1, 20, 53, 56, 6, 69, 1), 1)
The flag for result is set to 1, stating that the parse() function did in fact find a 'date only'. Perhaps even odder, it populates the time poetionbof the returned object as well with seemingly random time info as well (not the current time of the system).
With this information, do you think it is fair to say this is a bug?
Thanks again,
-TD
You received this message because you are subscribed to a topic in the Google Groups "parsedatetime-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/parsedatetime-dev/Ex20k4boAgE/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to parsedatetime-...@googlegroups.com.
Thanks again for the quick response Bear. In the SO question, I provided the example here:
print p.parse("Mary had a little lamb.")
Which returns:
((2014, 3, 1, 20, 53, 56, 6, 69, 1), 1)
The flag for result is set to 1, stating that the parse() function did in fact find a 'date only'. Perhaps even odder, it populates the time poetionbof the returned object as well with seemingly random time info as well (not the current time of the system).
With this information, do you think it is fair to say this is a bug?