[Biopython-dev] [Bug 2945] update_pdb: shutil.move needs to be indented; try block also?

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Thu Nov 5 11:13:32 EST 2009


http://bugzilla.open-bio.org/show_bug.cgi?id=2945


biopython-bugzilla at maubp.freeserve.co.uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED




------- Comment #5 from biopython-bugzilla at maubp.freeserve.co.uk  2009-11-05 11:13 EST -------
(In reply to comment #4)
> I downloaded the updated PDBList.py from github. Unfortunately, testing fails
> for several reasons:
> 1. The code you wrote includes an 'if' statement:
>             if os.path.isfile(old_file) :
>                 try :
>                     shutil.move(old_file, new_file)
>                 except :
>                     warnings.warn("Could not move %s to obsolete folder" \
>                                   % pdb_code, RuntimeWarning)
> If the file does NOT exist, then no warning is issued as if the file HAD
> existed and HAD been moved. This is a bug ...

Why is this a bug? If the file does not exist, there is no point trying
to move it. But OK, a message here could be informative.

> 2. At least on Windows, if the subfolders of the obsolete folder do not exist,
> a warning will be issued as well: python will create the 'obsolete' subolder
> folder but will not create the subfolders under that. This will occur even if
> the files DO exist and COULD be moved: a different kind of error. We just need
> to create the subfolders, and warn if we can't.

That's a separate bug. Fixed now.

> 3. Not a bug, but an enhancement: As a user, I'd rather see the whole new_file
> name instead of the pdb_code.

Fair enough. I felt having a very long message with both the old and the new
paths was excessive, but at least including the old path would be a useful
compromise.

> To sum up, the below code will implement all those changes. Whether there are
> other errors or not I have not checked. But I did check the above
> warnings/errors with testing:

I've updated the repository along similar lines:
http://github.com/biopython/biopython/blob/master/Bio/PDB/PDBList.py

Marking this bug as fixed.

Peter


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Biopython-dev mailing list