Python to open command script file

D

dave rose

Hello all
I would like to know how to do the following. I'd like to have a generic
python program that the user will open a command-script file to do actions.

So, my python program will get a list of servers, enumerate them within a
checklistbox in wxpython. Then I want to open a command-file that will run
against each selected server that will look like this:

---------------------------SAMPLE------------------------
copy abc.xyz from c:\source to u:\target
copy all from c:\source to u:\target
unload netshld from server1
-------------------------END SAMPLE----------------------

(where I have a class serverfuncs, where I can:
s = serverfuncs()
s.unload('<module>', '<server>')

Really, I can do all the actions, but I don't know how to trigger them from an
independent script file.

Thanks!
-Dave
 
M

Mike Driscoll

Hello all
 I would like to know how to do the following.  I'd like to have a generic
python program that the user will open a command-script file to do actions.

So, my python program will get a list of servers, enumerate them within a
checklistbox in wxpython.  Then I want to open a command-file that will run
against each selected server that will look like this:

---------------------------SAMPLE------------------------
copy abc.xyz from c:\source to u:\target
copy all     from c:\source to u:\target
unload netshld from server1
-------------------------END SAMPLE----------------------

(where I have a class serverfuncs, where I can:
s = serverfuncs()
s.unload('<module>', '<server>')

Really, I can do all the actions, but I don't know how to trigger them from an
independent script file.

Thanks!
-Dave

I usually use python's included shutil module for copying files and
directories. I think that would be a little more cross-platform
friendly. However, if you want to execute those commands above, try
using the subprocess module or os.system.

Mike
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top