# Ping-python with Ping2 - "device or resource busy"

**URL:** https://discuss.bluerobotics.com/t/ping-python-with-ping2-device-or-resource-busy/15007
**Category:** Ping Sonar Devices
**Tags:** ping
**Created:** [September 5, 2023, 6:49pm UTC](https://discuss.bluerobotics.com/t/ping-python-with-ping2-device-or-resource-busy/15007 "2023-09-05T18:49:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Maive](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@Maive](https://discuss.bluerobotics.com/u/Maive)
#### Post date: [September 5, 2023, 6:49pm UTC](https://discuss.bluerobotics.com/t/ping-python-with-ping2-device-or-resource-busy/15007/1 "2023-09-05T18:49:07Z")

</div>

Hi all!

I am trying to use ping-python (available on github, at [this adress](https://github.com/bluerobotics/ping-python)). I installed everything under linux on a Raspberry Pi4.

To do so, I followed the installation guide available on the github I published above. However, there is a problem of device availablity each time I connect the Ping. I get the error message “Exception: Failed to open the given serial port: [Errno 16] could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: ‘/dev/ttyUSB0’”.

However, when I unplug and plug back the Ping2 (without exiting python), everything works fine. This is not ideal, and I was wondering if there was a python command that could be equivalent to plugging in and out ? I would like to be able to command the Raspberry Pi remotely, without human intervention !

The following image is a capture of what happens showing the code I run. The red line and arrow correspond to my intervention (plugging in and out the Raspberry).

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/2/2c43d20907cd9f9cd64bc6a7c871cd1b3b762ae1.png)

Thanks for taking the time to read my post 🙂
