# How to delete a session from python code

**URL:** <https://support.prodi.gy/t/how-to-delete-a-session-from-python-code/3072>\
**Category:** Uncategorized\
**Tags:** usage, database, solved\
**Created:** [June 24, 2020, 7:40pm UTC](https://support.prodi.gy/t/how-to-delete-a-session-from-python-code/3072 "2020-06-24T19:40:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![olivierwa](https://avatars.discourse-cdn.com/v4/letter/o/aeb1de/32.png) [@olivierwa](https://support.prodi.gy/u/olivierwa)\
**Post date:** [June 24, 2020, 7:40pm UTC](https://support.prodi.gy/t/how-to-delete-a-session-from-python-code/3072/1 "2020-06-24T19:40:44Z")

</div>

Hello,  
I am trying to delete a session from python code. I see two functions called trash\_session and trash\_sessions but somehow calling them return a PermissionError:

`The process cannot access the file because it is being used by another process`

Is there any API to remove a session similar to drop\_dataset or drop\_example?

Thanks,  
Olivier

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [June 25, 2020, 10:06am UTC](https://support.prodi.gy/t/how-to-delete-a-session-from-python-code/3072/2 "2020-06-25T10:06:00Z")

</div>

Hi! As far as I know, the trash methods are only internals for Prodigy Teams and not currently used in Prodigy itself. Under the hood, a session dataset is just a regular dataset – so if you have a dataset `my_dataset` and a session `oliver`, the session dataset is `my_dataset-oliver` and you should be able to just run `prodigy drop my_dataset-oliver`, or `db.drop_dataset("my_dataset-oliver")`.

---

<div class="post-metadata">

**Author:** ![olivierwa](https://avatars.discourse-cdn.com/v4/letter/o/aeb1de/32.png) [@olivierwa](https://support.prodi.gy/u/olivierwa)\
**Post date:** [July 8, 2020, 8:53am UTC](https://support.prodi.gy/t/how-to-delete-a-session-from-python-code/3072/3 "2020-07-08T08:53:53Z")

</div>

Thank you Ines. It did the job!

Olivier
