Re: [Tutor] Python-windows command prompt interaction?

2008-06-11 Thread Tim Golden

Trey Keown wrote:

Hey all,
  I'm creating a program that will copy a user's internet history from
Internet Explorer, and I'm having a bit of trouble.

I need to get python to either initiate a command via the command prompt,
or open a file with its default program (in this case, a .bat file with
cmd.exe).

I've been googling a bit, but I can't seem to find any answers.


Depending on *exactly* what you're trying to achieve here, you're
going to want one of two things:

1) The subprocess module (and probably the call function)

http://docs.python.org/lib/node529.html


2) The os module's startfile function

http://docs.python.org/lib/os-process.html


There are other possiblities open to you, including automating
IE and using comtypes to access the IURLHistory interfaces, but
if you're just starting out then maybe you're better off sticking
with the builtin stuff.

TJG
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python-windows command prompt interaction?

2008-06-10 Thread Juzzy Dee
On Wed, Jun 11, 2008 at 3:11 PM, Trey Keown <[EMAIL PROTECTED]> wrote:

> Hey all,
>  I'm creating a program that will copy a user's internet history from
> Internet Explorer, and I'm having a bit of trouble.
>
> I need to get python to either initiate a command via the command prompt,
> or open a file with its default program (in this case, a .bat file with
> cmd.exe).
>
> I've been googling a bit, but I can't seem to find any answers.
>
> Thanks for any help.
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>

---

I think os.system should do the trick in running something from the command
line.

e.g

os.sytem('dir')

Will run the dir command. I'm not sure if that's what you're looking for but
it sounds about right.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python-windows command prompt interaction?

2008-06-10 Thread Trey Keown
Hey all,
  I'm creating a program that will copy a user's internet history from
Internet Explorer, and I'm having a bit of trouble.

I need to get python to either initiate a command via the command prompt,
or open a file with its default program (in this case, a .bat file with
cmd.exe).

I've been googling a bit, but I can't seem to find any answers.

Thanks for any help.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor