Getting a Python program to run of off a flash drive?

A

Abethebabe

I wanted to know if there was a way I could get a Python program to
run off of my flash drive as soon as the computer (Windows) detected
the device?

For example I could have a a simple program that would create a text
document on the computers desktop when my flash drive is detected.
 
R

rantingrick

I wanted to know if there was a way I could get a Python program to
run off of my flash drive as soon as the computer (Windows) detected
the device?

For example I could have a a simple program that would create a text
document on the computers desktop when my flash drive is detected.

Well i sure hope your intentions are for the forces of good and NOT
the forces of evil. Anyway the beauty of USB is the fact you can read
and write to it just like any other file on your harddisc, unlike with
CD media where you need a CS degree and MS's blessing. So now the
question really is

""" How do i run a python script when i plug in my flash drive"""?

And thats a good question. Well it's going to involve "something"
watching and waiting for this (big hint) "event" to happen. Maybe
something like a "Flash Drive plug in watcher sevice" Do you have any
experience with win32 programming?
 
A

Alf P. Steinbach

* Abethebabe:
I wanted to know if there was a way I could get a Python program to
run off of my flash drive as soon as the computer (Windows) detected
the device?

For example I could have a a simple program that would create a text
document on the computers desktop when my flash drive is detected.

As long as its your own computer, no problem.

However, in the war between the corporate "we own your computer" and the
individual's "I think the computer's mine" (so eloquently expressed as the main
goal of the 70's Smalltalk project, to bring effective computing to the masses)
the arms race is currently stuck at a point where any computer-literate person
running Windows turns off the various run-automatically features as soon as
they're sneak-introduced by Windows service packs and IE updates and whatever. I
don't know, but I think there are six or seven such schemes. Happily, as far as
I know they can all be turned off. If not for this then the recording industry
could have sued a lot of people in Norway. But our laws require copy protection
schemes to be effective, and a scheme based on a feature that most intelligent
persons have turned off isn't effective, so wrt. law it's like it's not there.

I think it was EMI who once distributed a nasty rootkit (and yes, it was theirs,
it was not an accident) as a copy protection scheme on a music CD. Getting a lot
of bad publicity for that they and other record companies didn't back off but
continued with just less malware-like auto run protection. I was perplexed when
I learned that one CD with Madrugada, that I'd copied to my hard disk, was
supposedly protected this way. Sure enough, there was this sticker on it.
However, since the idiot scheme they used was based on auto-run I never noticed.


Cheers,

- Alf
 
A

Abethebabe

Well i sure hope your intentions are for the forces of good and NOT
the forces of evil. Anyway the beauty of USB is the fact you can read
and write to it just like any other file on your harddisc, unlike with
CD media where you need a CS degree and MS's blessing. So now the
question really is

""" How do i run a python script when i plug in my flash drive"""?

And thats a good question. Well it's going to involve "something"
watching and waiting for this (big hint) "event" to happen. Maybe
something like a "Flash Drive plug in watcher sevice" Do you have any
experience with win32 programming?

I'm a web programmer and python is my first delve into desktop
programming. I had a rough guesstimation that I'd need to maybe use
wxpython with an API for the flash drive (wasn't sure if hardware had
this, I guess it would be the drivers?)

So do you think wxPython would have the answer I'm looking for? Thanks
for your reply btw
 
A

Abethebabe

* Abethebabe:



As long as its your own computer, no problem.

However, in the war between the corporate "we own your computer" and the
individual's "I think the computer's mine" (so eloquently expressed as the main
goal of the 70's Smalltalk project, to bring effective computing to the masses)
the arms race is currently stuck at a point where any computer-literate person
running Windows turns off the various run-automatically features as soon as
they're sneak-introduced by Windows service packs and IE updates and whatever. I
don't know, but I think there are six or seven such schemes. Happily, as far as
I know they can all be turned off. If not for this then the recording industry
could have sued a lot of people in Norway. But our laws require copy protection
schemes to be effective, and a scheme based on a feature that most intelligent
persons have turned off isn't effective, so wrt. law it's like it's not there.

I think it was EMI who once distributed a nasty rootkit (and yes, it was theirs,
it was not an accident) as a copy protection scheme on a music CD. Getting a lot
of bad publicity for that they and other record companies didn't back off but
continued with just less malware-like auto run protection. I was perplexed when
I learned that one CD with Madrugada, that I'd copied to my hard disk, was
supposedly protected this way. Sure enough, there was this sticker on it.
However, since the idiot scheme they used was based on auto-run I never noticed.

Cheers,

- Alf

Interesting, so every new computer I'd use it on I would need to
disable these filters? If I could just disable them on my computer
though I'd be happy enough.
 
A

Aahz

I think it was EMI who once distributed a nasty rootkit (and yes, it
was theirs, it was not an accident) as a copy protection scheme on a
music CD.

Sony, and I still (mostly) boycott Sony. (I buy no Sony hardware, but
because Sony owns a movie studio, it's a little more difficult to boycott
Sony DVDs.)
 
R

rantingrick

Sony, and I still (mostly) boycott Sony.  (I buy no Sony hardware, but
because Sony owns a movie studio, it's a little more difficult to boycott
Sony DVDs.)


Yea and i love how MS ships with autorun default to "ON" for
EVERYTHING!. Not to mention remote registry, and many other
atrocities. I have a whole list of unsafe settings i have to turn off
evry time i do a clean install.

Of course they *claim* it's because the lemmings are not smart enough
to open "my computer" and double click the CD icon (which has *some*
merits) but come on microsoft, with all the other crap you ship wide
open don't play coy with us!

And what did ever happen to Sony for such evil malware spreading
practices, a slap on the wrist thats what, filthy pigs!
 
T

timo verbeek

I wanted to know if there was a way I could get a Python program to
run off of my flash drive as soon as the computer (Windows) detected
the device?

For example I could have a a simple program that would create a text
document on the computers desktop when my flash drive is detected.

You could use Autorun.inf if your using Windows but for linux I don't
now
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top