how do you make the python script run when the computer realizes that the flash drive is there when is not in your computer....I'm making a internet boost program and its on a flash drive but i don't want to have to navigate to start it...Thanks

TrustyTony commented: Make your own thread -3

You could have a script running locally that detects when the root path to that usb drive is created.

import os.path
for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
    drive_mounted[letter] = os.path.exists(letter + ":")

This script would have to be running locally when you plug in the USB drive. This works for Windows-style paths. If you are running *nix, you'll need to change the os.path.exists method parameters to match that style of path.

Source: StackOverflow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.