Modify Time

wormtongue
2006-06-28
2012-09-14
  • wormtongue
    wormtongue
    2006-06-28

    Hi,

    I've searched long to find something as perfect for my needs as PyPE is. It's fast, and light, and yummy. I have one problem at the moment. :(

    It seems that PyPE does not change the modified time of files when I save. Currently I am working with turbogears, and the development server reloads files based on the time which they are modified. So using PyPE, I need to close the server manually, and force regeneration.

    How can I change this?

    Thanks for making something really nice.

    cb

     
    • Josiah Carlson
      Josiah Carlson
      2006-06-29

      What OS, version of Python, filesystem, etc? According to my tests using Python 2.3 and 2.4 on Windows and linux, PyPE updates the modification time of a file when it saves it (you can verify witho s.stat(<filename>).st_mtime ).

       
      • wormtongue
        wormtongue
        2006-06-30

        I actually had a dream about this last night - that I did not mention these details! (it's important; I've never had an editor that I liked before, and I've been editing long enough!).

        I'm using python 2.4.2, on Windows 2000 professional b 2195 patched to the hilt, and wxpython 2.6. The disk is NTFS, formatted by the windows installation.

        I hacked the turbogears cherrypy reloader to scan atimes, instead of mtimes, but this doesn't work too well, because the pyc/pyo files throughout the system are not being refreshed. I then created a script which I attach to an icon, which walks through a tree and removes .pyc files to force regen, and touches all others so turbogears sees new mtimes. It's not ideal, but it seems worth it to me, at least in the short-future.

        I can't imagine why this would be happening, or what I could have misconfigured to cause it, but other editors (msdev, pythonwin, multi-edit, etc) save mtimes, and so I am guessing that it isn't a system error. Acess Times are updated on disk as usual.

        Thank you for your reply!

        CB

         
        • Josiah Carlson
          Josiah Carlson
          2006-06-30

          I'm completely at a loss as to why on your platform, mtime is not being updated when you save in PyPE. Have you explicitly tested for the lack of a change when PyPE saves? Something like...

          import os, time, sys
          filename = sys.argv[1]
          x = os.stat(filename).st_mtime
          while 1:
          _y = os.stat(filename).st_mtime
          _if x == y: time.sleep(1)
          ____else: break
          print "mtime changed for %s from %i to %i"%(filename, x, y)

          (replace the above leading underscores with spaces)

          Now, if you are saying that PyPE doesn't update atime, I wouldn't be terribly surprised. I haven't noticed atime updates myself, but then again, I'm pretty sure I turned off those updates on my filesystems. Now, even if it were turned on, and PyPE wasn't updating it, I wouldn't know where to start. I'm opening, reading, and writing files using the standard open(), .read(), and .write() mechanism, and if that isn't doing it, then I don't know what would.