I wrote up a function in Python that looks for a USB drive based on a key identifier file, however when called upon it returns 'There is no disk in the drive. Please insert a disk into drive D:/' (which is an SD card reader) - is there a way to have it search drive letters based on drives that are 'ready'?
def FETCH_USBPATH():
for USBPATH in ascii_uppercase:
if os.path.exists('%s:\\File.ID' % USBPATH):
USBPATH='%s:\\' % USBPATH
print('USB is mounted to:', USBPATH)
return USBPATH + ""
return ""
USBdrive = FETCH_USBPATH()
while USBdrive == "":
print('Please plug in USB & press any key to continue', end="")
input()
FlashDrive = FETCH_USBPATH()
Had a fix in cmd here however turned out command-prompt based didn't suit my needs.