datetime.strptime unexpected behavior - locale issue
<p>Wondering if anyone has a workaround for a strange error I am getting with <a href="https://docs.python.org/2/library/datetime.html#datetime.datetime.strptime" rel="nofollow"><code>datetime.datetime.strptime</code></a>.</p>

<p><strong>NOTE:</strong> not a duplicate of the timezone issue.</p>

<p>I am getting this exception (trimmed proprietary parts):</p>

<pre><code>Traceback (most recent call last):
  ...
  File "/usr/local/lib/python2.7/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data 'Jul 10 12:45:52 2016' does not match format '%b %d %H:%M:%S %Y'
</code></pre>

<p>This exception happens during run-time on real data. But when I test it locally with the same data it works?!</p>

<p>You can even test yourself, The exception itself doesn't make much sense since I actually <em>can</em> use that format to match the datetime format:</p>

<pre><code>&gt;&gt;&gt; from datetime import datetime
&gt;&gt;&gt; s = 'Jul 10 12:45:52 2016'
&gt;&gt;&gt; p = '%b %d %H:%M:%S %Y'
&gt;&gt;&gt; d = datetime.strptime(s, p)
&gt;&gt;&gt; print d
2016-07-10 12:45:52
</code></pre>

<p>Really not sure what is going on here. Any help appreciated. (Python 2.7.11)</p>