On Mon, 30 May 2016, 21:08 Ni Va, <nivaem...@gmail.com> wrote: > > _____________ > Output: > Traceback (most recent call last): > File "<string>", line 1, in <module> > File "<string>", line 16, in PyExecReplace > File "<string>", line 22, in <module> > File "<string>", line 11, in foo > NameError: global name 'time' is not defined >
Based on your traceback it looks like the problem is actually not in your code, but in the way you're running it. PyExecReplace appears to be part of a vim plugin for running snippets of Python within vim. It looks like it uses exec() to actually run the code. A search online for something like "python exec import" might help explain why you're having problems with that (or add to the confusion... I had a quick look for a difinitive answer but have given up for now). Try running your script directly from the command line using python instead and you may get better results :) > -- https://mail.python.org/mailman/listinfo/python-list