Automatically deleting pyc files when corresponding py is moved (Mercurial)
        Posted  
        
            by Oddthinking
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Oddthinking
        
        
        
        Published on 2010-03-27T05:46:16Z
        Indexed on 
            2010/03/27
            5:53 UTC
        
        
        Read the original article
        Hit count: 405
        
(I foresaw this problem might happen 3 months ago, and was told to be diligent to avoid it. Yesterday, I was bitten by it, hard, and now that it has cost me real money, I am keen to fix it.)
If I move one of my Python source files into another directory, I need to remember to tell Mercurial that it moved (hg move).
When I deploy the new software to my server with Mercurial, it carefully deletes the old Python file and creates it in the new directory.
However, Mercurial is unaware of the pyc file in the same directory, and leaves it behind. The old pyc is used preferentially over new python file by other modules in the same directory.
What ensues is NOT hilarity.
How can I persuade Mercurial to automatically delete my old pyc file when I move the python file? Is there another better practice? Trying to remember to delete the pyc file from all the Mercurial repositories isn't working.
© Stack Overflow or respective owner