Send2Trash


NameSend2Trash JSON
Version 1.8.3 PyPI version JSON
download
home_pagehttps://github.com/arsenetar/send2trash
SummarySend file to trash natively under Mac OS X, Windows and Linux
upload_time2024-04-07 00:01:09
maintainerNone
docs_urlNone
authorAndrew Senetar
requires_python!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7
licenseBSD License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==================================================
Send2Trash -- Send files to trash on all platforms
==================================================

Send2Trash is a small package that sends files to the Trash (or Recycle Bin) *natively* and on
*all platforms*. On OS X, it uses native ``FSMoveObjectToTrashSync`` Cocoa calls or can use pyobjc 
with NSFileManager. On Windows, it uses native ``IFileOperation`` call if on Vista or newer and 
pywin32 is installed or falls back to ``SHFileOperation`` calls. On other platforms, if `PyGObject`_ 
and `GIO`_ are available, it will use this.  Otherwise, it will fallback to its own implementation of 
the `trash specifications from freedesktop.org`_.

``ctypes`` is used to access native libraries, so no compilation is necessary.

Send2Trash supports Python 2.7 and up (Python 3 is supported).

Status: Additional Help Welcome
-------------------------------

Additional help is welcome for supporting this package.  Specifically help with the OSX and Linux 
issues and fixes would be most appreciated.

Installation
------------

You can download it with pip:

    python -m pip install -U send2trash

To install with pywin32 or pyobjc required specify the extra `nativeLib`:

    python -m pip install -U send2trash[nativeLib]

or you can download the source from http://github.com/arsenetar/send2trash and install it with::

    >>> python setup.py install

Usage
-----

>>> from send2trash import send2trash
>>> send2trash('some_file')
>>> send2trash(['some_file1', 'some_file2'])

On Freedesktop platforms (Linux, BSD, etc.), you may not be able to efficiently
trash some files. In these cases, an exception ``send2trash.TrashPermissionError``
is raised, so that the application can handle this case. This inherits from
``PermissionError`` (``OSError`` on Python 2). Specifically, this affects
files on a different device to the user's home directory, where the root of the
device does not have a ``.Trash`` directory, and we don't have permission to
create a ``.Trash-$UID`` directory.

For any other problem, ``OSError`` is raised.

.. _PyGObject: https://wiki.gnome.org/PyGObject
.. _GIO: https://developer.gnome.org/gio/
.. _trash specifications from freedesktop.org: http://freedesktop.org/wiki/Specifications/trash-spec/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/arsenetar/send2trash",
    "name": "Send2Trash",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Andrew Senetar",
    "author_email": "arsenetar@voltaicideas.net",
    "download_url": "https://files.pythonhosted.org/packages/fd/3a/aec9b02217bb79b87bbc1a21bc6abc51e3d5dcf65c30487ac96c0908c722/Send2Trash-1.8.3.tar.gz",
    "platform": null,
    "description": "==================================================\r\nSend2Trash -- Send files to trash on all platforms\r\n==================================================\r\n\r\nSend2Trash is a small package that sends files to the Trash (or Recycle Bin) *natively* and on\r\n*all platforms*. On OS X, it uses native ``FSMoveObjectToTrashSync`` Cocoa calls or can use pyobjc \r\nwith NSFileManager. On Windows, it uses native ``IFileOperation`` call if on Vista or newer and \r\npywin32 is installed or falls back to ``SHFileOperation`` calls. On other platforms, if `PyGObject`_ \r\nand `GIO`_ are available, it will use this.  Otherwise, it will fallback to its own implementation of \r\nthe `trash specifications from freedesktop.org`_.\r\n\r\n``ctypes`` is used to access native libraries, so no compilation is necessary.\r\n\r\nSend2Trash supports Python 2.7 and up (Python 3 is supported).\r\n\r\nStatus: Additional Help Welcome\r\n-------------------------------\r\n\r\nAdditional help is welcome for supporting this package.  Specifically help with the OSX and Linux \r\nissues and fixes would be most appreciated.\r\n\r\nInstallation\r\n------------\r\n\r\nYou can download it with pip:\r\n\r\n    python -m pip install -U send2trash\r\n\r\nTo install with pywin32 or pyobjc required specify the extra `nativeLib`:\r\n\r\n    python -m pip install -U send2trash[nativeLib]\r\n\r\nor you can download the source from http://github.com/arsenetar/send2trash and install it with::\r\n\r\n    >>> python setup.py install\r\n\r\nUsage\r\n-----\r\n\r\n>>> from send2trash import send2trash\r\n>>> send2trash('some_file')\r\n>>> send2trash(['some_file1', 'some_file2'])\r\n\r\nOn Freedesktop platforms (Linux, BSD, etc.), you may not be able to efficiently\r\ntrash some files. In these cases, an exception ``send2trash.TrashPermissionError``\r\nis raised, so that the application can handle this case. This inherits from\r\n``PermissionError`` (``OSError`` on Python 2). Specifically, this affects\r\nfiles on a different device to the user's home directory, where the root of the\r\ndevice does not have a ``.Trash`` directory, and we don't have permission to\r\ncreate a ``.Trash-$UID`` directory.\r\n\r\nFor any other problem, ``OSError`` is raised.\r\n\r\n.. _PyGObject: https://wiki.gnome.org/PyGObject\r\n.. _GIO: https://developer.gnome.org/gio/\r\n.. _trash specifications from freedesktop.org: http://freedesktop.org/wiki/Specifications/trash-spec/\r\n",
    "bugtrack_url": null,
    "license": "BSD License",
    "summary": "Send file to trash natively under Mac OS X, Windows and Linux",
    "version": "1.8.3",
    "project_urls": {
        "Bug Reports": "https://github.com/arsenetar/send2trash/issues",
        "Homepage": "https://github.com/arsenetar/send2trash"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "40b04562db6223154aa4e22f939003cb92514c79f3d4dccca3444253fd17f902",
                "md5": "a9d81ae57db66e202ecf5b999849e4dc",
                "sha256": "0c31227e0bd08961c7665474a3d1ef7193929fedda4233843689baa056be46c9"
            },
            "downloads": -1,
            "filename": "Send2Trash-1.8.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9d81ae57db66e202ecf5b999849e4dc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
            "size": 18072,
            "upload_time": "2024-04-07T00:01:07",
            "upload_time_iso_8601": "2024-04-07T00:01:07.438879Z",
            "url": "https://files.pythonhosted.org/packages/40/b0/4562db6223154aa4e22f939003cb92514c79f3d4dccca3444253fd17f902/Send2Trash-1.8.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd3aaec9b02217bb79b87bbc1a21bc6abc51e3d5dcf65c30487ac96c0908c722",
                "md5": "7bcae0e6d450c1004fd98a977f5648c2",
                "sha256": "b18e7a3966d99871aefeb00cfbcfdced55ce4871194810fc71f4aa484b953abf"
            },
            "downloads": -1,
            "filename": "Send2Trash-1.8.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7bcae0e6d450c1004fd98a977f5648c2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7",
            "size": 17394,
            "upload_time": "2024-04-07T00:01:09",
            "upload_time_iso_8601": "2024-04-07T00:01:09.267743Z",
            "url": "https://files.pythonhosted.org/packages/fd/3a/aec9b02217bb79b87bbc1a21bc6abc51e3d5dcf65c30487ac96c0908c722/Send2Trash-1.8.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-07 00:01:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "arsenetar",
    "github_project": "send2trash",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "send2trash"
}
        
Elapsed time: 0.28976s