On Mon, May 15, 2017 at 9:03 AM, Terry Brown <terrynbr...@gmail.com> wrote:
# this script, when executed in a node > from subprocess import Popen, PIPE > cmd = Popen(['diff', 'this', 'that'], stdin=PIPE, stderr=PIPE) > p.b += "%s\n%s" % cmd.communicate() > c.redraw() > # appends this text to that node, 'None' being stdout, and the errors > being stderr. > None > diff: this: No such file or directory > diff: that: No such file or directory > > But to diff the two previous nodes: > > p0 = p.copy().moveToThreadBack() # prev node > p1 = p0.copy().moveToThreadBack() # prev prev node > > import difflib > p.b += '\n'.join(difflib.unified_diff( > p1.b.split('\n'), p0.b.split('\n'), fromfile='prev.prev', > tofile='prev')) > c.redraw() > ​Thanks, Terry. This shows two reasonable solutions. There will be others, depending on situation. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.