classification
Title: 2to3 should detect and delete import of removed statvfs module
Type: enhancement Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.0
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, sjt, terry.reedy
Priority: low Keywords:

Created on 2009-02-13 18:27 by sjt, last changed 2011-10-14 14:03 by terry.reedy.

Messages (5)
msg81959 - (view) Author: Stephen J. Turnbull (sjt) Date: 2009-02-13 18:27
It should also try to convert stuff like

from statvfs import F_BAVAIL, F_FRSIZE
status = os.statvfs(directory)
available = status[F_BAVAIL]/((1024*1024)/status[F_FRSIZE]
msg81967 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-02-13 19:29
Hmm. 2to3 doesn't currently mess with the stat module and os.stat the
more common function. Also the new interface (attributes on the objects
returned) has been around since 2.2.
msg82006 - (view) Author: Stephen J. Turnbull (sjt) Date: 2009-02-14 10:33
Benjamin Peterson writes:

 > Hmm. 2to3 doesn't currently mess with the stat module and os.stat the
 > more common function. Also the new interface (attributes on the objects
 > returned) has been around since 2.2.

So what?  You *can't* import a nonexistent module, so the import
statement should be removed to save the programmer the trouble.
msg82045 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-02-14 13:33
On Sat, Feb 14, 2009 at 4:33 AM, Stephen J. Turnbull
<report@bugs.python.org> wrote:
>
> Stephen J. Turnbull <stephen@xemacs.org> added the comment:
>
> Benjamin Peterson writes:
>
>  > Hmm. 2to3 doesn't currently mess with the stat module and os.stat the
>  > more common function. Also the new interface (attributes on the objects
>  > returned) has been around since 2.2.
>
> So what?  You *can't* import a nonexistent module, so the import
> statement should be removed to save the programmer the trouble.

No, the programmer should remove the import statement when he's
porting it to use the attributes of the statvfs call.
msg145517 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-10-14 14:03
Benjamin, you seem to have rejected this feature request. Close it?
History
Date User Action Args
2011-10-14 14:03:01terry.reedysetnosy: + terry.reedy
messages: + msg145517
2009-02-14 13:33:13benjamin.petersonsetmessages: + msg82045
2009-02-14 10:33:42sjtsetmessages: + msg82006
2009-02-13 19:29:13benjamin.petersonsetpriority: low
nosy: + benjamin.peterson
messages: + msg81967
2009-02-13 18:27:05sjtcreate