I am executing python files from vim as described here: How to execute file I'm editing in Vi(m)
I observe the same behavior on Windows & Linux. For testing, I moved my .vim so as to avoid other plugins interfering. Then I set:
:set makeprg=python\ %
Now when I run an example file like this (called mini.py)
import datetime
print "hello"
def foo1():
print "foo"
print "str: " + str(datetime.datetime.now())
print "str: " + str(datetime.datetime.now().date())
foo1()
Now when I execute
:make
"mini.py" 10L, 173C written
:!python mini.py 2>&1| tee /tmp/vew33jl/9
hello
foo
str: 2013-05-07 17:01:47.124149
str: 2013-05-07
"str: 2013-05-07 17" [New File]
(3 of 4): 47.124149
vim kind of chokes on the datetime.now output and creates a new file with the current date and instantly displays it.
Is this behavior to be expected?
If I comment out the .now() line (now().date() is not a problem apparently), it works as expected and I more or less see the text output that I'd expect.