detecting document changes

Discussion in 'Python' started by Alessandro Crugnola *sephiroth*, Aug 24, 2003.

  1. Alessandro Crugnola *sephiroth*, Aug 24, 2003
    #1
    1. Advertising

  2. Alessandro Crugnola *sephiroth*

    Cliff Wells Guest

    On Sun, 2003-08-24 at 02:36, Alessandro Crugnola *sephiroth* wrote:
    > Hi,
    > i'm using wxPython and wxTextStyled.
    > How can I intercept document changes for active documents (for example
    > modified with others external editors)?


    If you're on Linux (and perhaps other Unices) you can use FAM (file
    alteration monitor). There's a Python library for the SGI version of
    FAM (I don't know if it will work with anything other than XFS):

    http://python-fam.sourceforge.net/

    also check out this link:

    http://oss.sgi.com/projects/fam/faq.html

    If you're looking for a more general or cross-platform solution then
    probably just periodically checking timestamp/size/md5sum for the file
    is another (albeit somewhat less elegant) option.

    Regards,

    --
    Cliff Wells, Software Engineer
    Logiplex Corporation (www.logiplex.net)
    (503) 978-6726 (800) 735-0555
     
    Cliff Wells, Aug 25, 2003
    #2
    1. Advertising

  3. Alessandro Crugnola *sephiroth*

    Tim Golden Guest

    "Cliff Wells" <> wrote in message news:<>...
    > On Sun, 2003-08-24 at 02:36, Alessandro Crugnola *sephiroth* wrote:
    > > How can I intercept document changes for active documents (for example
    > > modified with others external editors)?

    >
    > If you're on Linux (and perhaps other Unices) you can use FAM


    Don't know if this is exactly what you're
    after, but there are a couple of recipes
    on the Cookbook:

    This one deals with Linux:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/217829

    and this one with Win32:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/156178

    The MSDN docs on FindFirstChangeNotification
    tell you which flags you need to use for
    modification (as opposed to addition etc.):

    http://msdn.microsoft.com/library/d...s/fileio/base/findfirstchangenotification.asp

    HTH
    TJG
     
    Tim Golden, Aug 27, 2003
    #3
  4. > and this one with Win32:
    >
    > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/156178


    thanks but that one check only new/deleted/renamed files (also useful indeed).
    I should check also for modified files.. but I think i can add the functionallity to that script..

    ...but is not too stressing for the cpu to check for file changes in a (forever) while loop?

    --

    Alessandro Crugnola [sephiroth]
    Flash | PHP Developer
    http://www.sephiroth.it
     
    Alessandro Crugnola *sephiroth*, Aug 27, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harvey
    Replies:
    2
    Views:
    395
    Simon Harvey
    Apr 29, 2004
  2. Replies:
    5
    Views:
    449
    Mohamed Sharaf
    Oct 13, 2005
  3. Joshua Jung
    Replies:
    5
    Views:
    2,832
    dealbaaj
    Oct 14, 2009
  4. Xin Xiao

    Detecting changes in entries

    Xin Xiao, Jan 1, 2008, in forum: VHDL
    Replies:
    8
    Views:
    469
  5. robert
    Replies:
    1
    Views:
    269
    Steven D'Aprano
    Sep 29, 2008
Loading...

Share This Page