New submission from Taylor Marks:

When you have a file that you don't think you need anymore, the proper thing to 
do with it is move it to the Trash (or Recycling Bin, if you're on Windows.)

The standard library, however, doesn't offer any way of doing this currently. 
Instead, the only thing it offers is the ability to delete files. Deleting 
files is a potentially dangerous operation. A novice programmer may end up 
carelessly delete the wrong file.

I would suggest adding in a new function which allows for cross-platform moving 
of files to trash. It could go into the existing shutil or os modules. Or it 
could get its own module (like glob).

It could be based upon (or even be exactly) this implementation:
https://pypi.python.org/pypi/Send2Trash
https://github.com/hsoft/send2trash

Afterwards, the docs for os.remove and shutil.rmtree could have a warning added 
that suggests that instead of using such dangerous functions, it may be best 
for the user to use the new function.

(If this is not the place to propose additions to the standard library, please 
redirect me for where I should go instead. PEP 5 covers how the language should 
evolve, but then only has a link to bugs.python.org.)

----------
components: Library (Lib)
messages: 243149
nosy: Taylor.Marks
priority: normal
severity: normal
status: open
title: Add Function for Sending File to Trash (or Recycling Bin)
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24185>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to