|
Boost Users : |
Subject: [Boost-users] [Boost.DateTime][Boost.Python] Year out of valid range error when streaming via Python module
From: SamuelG (sam.gundry_at_[hidden])
Date: 2010-08-31 02:11:55
This problem occurs at a higher level but I've tried to strip it back. I've
reproduced this problem GCC 4.3.4, Python 2.6.5 and Boost 1.41.0 32bit and
64bit Debians/Ubuntu. The problem does not seem to happen on Windows XP.
I have embedded the Python interpreter in the attached
http://old.nabble.com/file/p29579563/run_python.cpp run_python.cpp . When
running this with the attached script
http://old.nabble.com/file/p29579563/test.py test.py and which uses a test
module http://old.nabble.com/file/p29579563/test_date_time.cpp
test_date_time.cpp , the following Boost.DateTime error occurs:
$ run_python test.py
out() - entry
out() - to_simple_string(): 2010-Aug-31 14:30:33.439172000
out() - manual format: 2010-Aug-31 14509:17:19.172000
out() - oss.str(): 2010-Aug-31 14509:17:19.172000
out() - now: Traceback (most recent call last):
File "test.py", line 6, in <module>
test_date_time.output()
IndexError: Year is out of valid range: 1400..10000
However, when running the same script via python it is fine:
$ python test.py
out() - entry
out() - to_simple_string(): 2010-Aug-31 14:30:31.208160000
out() - manual format: 2010-Aug-31 14:30:31.208160000
out() - oss.str(): 2010-Aug-31 14:30:31.208160000
out() - now: 2010-Aug-31 14:30:31.208160000
out() - exit
Note that the time stamp in the first example is corrupt. Note also that the
valid range error does not occur when using the date and time facets
manually but when streaming the ptime object to std::cerr.
The problem first arose for me when using Boost.Log with separate Python
modules via *both* run_python and /usr/bin/python. See
http://sourceforge.net/projects/boost-log/forums/forum/710022/topic/3748054
http://sourceforge.net/projects/boost-log/forums/forum/710022/topic/3748054
For this simple case, /usr/bin/python seems okay but the run_python error is
identical to what happens in our proper application (where Boost.Log is used
and multiple Python modules loaded).
Has anyone witnessed similar behaviour? Or can they please test my example
out?
Thanks for any help,
Sam
-- View this message in context: http://old.nabble.com/-Boost.DateTime--Boost.Python--Year-out-of-valid-range-error-when-streaming-via-Python-module-tp29579563p29579563.html Sent from the Boost - Users mailing list archive at Nabble.com.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net