rules of thumb for cross os code

Adam E adam2new at gmail.com
Fri Aug 22 23:14:37 CEST 2008


On Aug 22, 9:55 am, DwBear75 <dwbea... at gmail.com> wrote:
> I am considering using python as a replacement for a lot of bash
> scripting that I have been doing. I would like to be as cross platform
> as possible, writing scripts for both windows and linux. Are there any
> guides are general rules of thumb on
> 1) keeping code os independant
> 2) nifty lambda's or other things to create functions fit for the
> environment
> 3) capturing return codes of other executables called from python; ie
> use os.system, or popen? or ?

you can try Programming Python 3rd Edition from O'Reilly or, at least,
the code for the book, which you can get from the author's site:
http://www.rmi.net/~lutz/
Note: it contains code for Python 2.4, but I never encountered any of
the code to not work when I tried it.  There is one directory that
contains out-of-date code, which you should find easily when reading
the text files.


I'm sorry that I can only help by referring you to Python 2.4 code.
But it is useful -- PyMailGUI and PyMailCGI are great examples, just
be careful not to be fed up with the large, high-level examples.



More information about the Python-list mailing list