Is pyton for me?
Mark de+la+Fuente
dela_f at excite.com
Thu Jun 9 22:50:20 EDT 2005
I need to write simple scripts for executing command line functions. Up till now I've used C-Shell scripts for this, but I'm looking for a better alternative. And I keep reading about how easy it is to program with python.
Unfortunately after reading "diveintopython" and the python tutorial, I'm not sure how to do what I need to do.
Here is an example of the type of thing I would like to be able to do. Can I do this with python? How do I get python to execute command line functions?
>From the command prompt (not from the python interpreter running linux for example) I would type:
gensky 3 21 12 > sky.rad
This would call the non-python program gensky which creates a computer model of a sky on march 21st at 12:00 PM and puts this information into a file called sky.rad.
If I create a CSH script like the one below, I can automate tasks by building loops along the lines of:
#!/bin/csh -fv
# simple script to create multiple sky files.
foreach hour (10 12 14)
gensky 3 21 $hour > sky$hour.rad
end
If I try and do a gensky command from the python interpreter or within a python.py file, I get an error message:
NameError: name gensky is not defined
So even if I get the python syntax correct, I cant get these commands to execute.
If anyone has any suggestions on how to get python scripts to execute this sort of thing, what I should be looking at, or if there is something else I might consider besides python, please let me know.
Thanks for your help.
Mark
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
More information about the Python-list
mailing list