This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年06月24日 11:41 by vinay.sajip, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (6) | |||
|---|---|---|---|
| msg138917 - (view) | Author: Vinay Sajip (vinay.sajip) * (Python committer) | Date: 2011年06月24日 11:41 | |
"pysetup3 remove projectX" fails on Windows. The reason is that the RECORD file can't be moved, as it's still open (we're using a generator in list_installed_files). Apart from fixing that, a related annoyance is that you get the [Error 32] The process cannot access the file because it is being used by another process but, of course, it doesn't tell you *which* file it failed on. So the error message needs to say which file(s) couldn't be moved. |
|||
| msg138919 - (view) | Author: Vinay Sajip (vinay.sajip) * (Python committer) | Date: 2011年06月24日 11:49 | |
I can confirm that putting a list() around the generator allows the removal to proceed: diff -r d2453f281baf Lib/packaging/install.py --- a/Lib/packaging/install.py Fri Jun 24 10:21:46 2011 +0100 +++ b/Lib/packaging/install.py Fri Jun 24 12:48:33 2011 +0100 @@ -389,7 +389,10 @@ dist = get_distribution(project_name, use_egg_info=True, paths=paths) if dist is None: raise PackagingError('Distribution "%s" not found' % project_name) - files = dist.list_installed_files(local=True) + # list_installed_files returns a generator, and we need the + # RECORD file itself closed so that we can move it - under Windows, + # you can't move an opened file + files = list(dist.list_installed_files(local=True)) rmdirs = [] rmfiles = [] tmp = tempfile.mkdtemp(prefix=project_name + '-uninstall') The error message does need fixing, though, for cases where something else has a distribution's files open. |
|||
| msg138923 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月24日 11:54 | |
> So the error message needs to say which file(s) couldn't be moved. Isn’t that a Windows error message which we have no control on? |
|||
| msg138925 - (view) | Author: Vinay Sajip (vinay.sajip) * (Python committer) | Date: 2011年06月24日 12:07 | |
We could fix the error message, for example, like this:
--- a/Lib/packaging/install.py Fri Jun 24 10:21:46 2011 +0100
+++ b/Lib/packaging/install.py Fri Jun 24 13:06:08 2011 +0100
@@ -412,6 +415,7 @@
error = _move_file(file_, tmpfile)
if error is not None:
success = False
+ failed_on = file_
break
finally:
if not os.path.isfile(file_):
@@ -425,7 +429,7 @@
if not success:
logger.info('%r cannot be removed.', project_name)
- logger.info('Error: %s' % str(error))
+ logger.info('Error: %s: %s' % (error, failed_on))
return False
logger.info('Removing %r: ', project_name)
|
|||
| msg138930 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月24日 12:14 | |
Ah, nice, just use %r for the filename. I’ll commit this improvement in a few days. Do you want to write a test for the remove error? |
|||
| msg144294 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年09月19日 16:09 | |
If I’m not mistaken, 2b9a0a091566 fixed this. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:18 | admin | set | github: 56604 |
| 2011年09月19日 16:09:15 | eric.araujo | set | status: open -> closed resolution: duplicate messages: + msg144294 superseder: packaging: fix database to stop skipping uninstall tests on win32 stage: needs patch -> resolved |
| 2011年06月24日 12:14:34 | eric.araujo | set | assignee: tarek -> eric.araujo messages: + msg138930 stage: needs patch |
| 2011年06月24日 12:07:31 | vinay.sajip | set | messages: + msg138925 |
| 2011年06月24日 11:54:41 | eric.araujo | set | messages: + msg138923 |
| 2011年06月24日 11:49:58 | vinay.sajip | set | messages: - msg138920 |
| 2011年06月24日 11:49:50 | vinay.sajip | set | messages: + msg138920 |
| 2011年06月24日 11:49:48 | vinay.sajip | set | messages: + msg138919 |
| 2011年06月24日 11:41:09 | vinay.sajip | create | |