[Eric] Renaming a file in Eric4 IDE does not remove the compiled Python file

Geert Vancompernolle geert.eric4 at gmail.com
Tue Jan 20 19:46:44 GMT 2009


Hi,

When renaming a file using the context menu in the source tab of the 
Project Viewer in Eric4, only the Python file is renamed.  If there 
exists a compiled version (.pyc) of the old file, this one is not removed.

This can lead to unexpected behaviour, because one would expect that, 
next to renaming the file, the original compiled file would be removed.

For instance, suppose I have the following project set-up:

./main.py
./ui/__init__.py
    /MainWindow.py  #contains the class MainWindow
    /Ui_LogParser.py

Now, in main.py, I can use the following import construction: from 
ui.MainWindow import MainWindow

I want to rename the file MainWindow.py into LogParser.py, using the 
Eric4 IDE (as described above).  I have the following new situation:

./main.py
./ui/__init__.py
    /LogParser.py   #contains the class MainWindow
    /Ui_LogParser.py

What I saw was, that both the following import constructions were working:

from ui.MainWindow import MainWindow
from ui.LogParser import MainWindow

At first, I didn't understand this.  Until the moment I saw that the 
file ./ui/MainWindow.pyc was still available.  That was revealing the 
mysterious behaviour...

So, is it possible to also delete the corresponding .pyc file, when one 
renames a .py file?  That would prevent the above...

-- 
Best rgds,

Geert
________________________________________________

*Use EcoCho <http://www.ecocho.com>: environmentally friendly search the 
internet!*



More information about the Eric mailing list