From: "Mark Smith" <Mark.Smith@capital-fx.co.uk>
Subject: RE: Using Rush in a slightly different way [for Framecycler]
   Date: Tue, 20 Sep 2005 10:57:04 -0700
Msg# 1039
View Complete Thread (3 articles) | All Threads
Last Next
Thanks for the Python example...

I've had a quick look and it is all making more sense already. I am away
till next week now but will let you know of my progress when I get back.

Interesting to see your views on Python. I haven't spent all that much
time with 'real' scripting languages. I can see from your examples how
many tasks can be made simpler with them. I think I'll have a look at
csh real soon....any good books you can recommend?

Maybe it's about getting the right mix of things. At my last place much
of the core pipeline code was Python....this could be the reason the
submission scripts were in Python too.

I see from the Rush documentation that you can source render
environments in csh but I'm not too sure it would be too easy to do if
you were creating your render environments by sucking things out of a
database. Or maybe I'm wrong?


 
Mark Smith
IT Engineer
Capital FX
20 Dering Street
London W1S 1AJ
United Kingdom
 
T: +44 (0)20 7493 9998
F: + 44 (0)20 7493 9997
-----Original Message-----
From: Greg Ercolano [mailto:erco@(email surpressed)] 
Sent: 19 September 2005 18:59
To: void@(email surpressed)
Subject: Re: Using Rush in a slightly different way [for Framecycler]

>>> Is there a Python version of the submit-generic script?
>> 
>>     No, and I'm not sure a python version of submit-generic
>>     would be as helpful as a python version of one of the other
scripts.
>> 
>>     What I might do is make a simple Python example script
>>     that shows how to submit a job through Rush.
> 
> A simple Python submit script would be brilliant...I'm afraid Perl
sends
> shivers up my spine.

     I converted the "rush/examples/input-example.pl" program into
python,
     and attached it here.

     There's already a .csh and .pl version of the script, so a .py file
     rounds it out nicely ;)

     I'm glad I did this experiment -- it made me look closely at
Python.

     I'm still new to it, so I know my knowledge is limited so far,
     but I'm pretty sure I /won't/ be thinking 'gee, I should port
     all the submit scripts to Python..!" ..it's not a good fit IMHO.

     Though Python's capable, Python seems to be more of a programming
language
     than a scripting language.. ie. it's more like C++ than CSH or
Perl;
     it sticks to strict programming guidelines (which is good, if
writing programs),
     but lacks syntax that makes /scripting/ pleasant.

     For instance, I miss the ability to 'easily' test for the existence
of a file,
     something scripts often do:

         PERL                           PYTHON
	if ( -e "/some/file" )         if ( os.path.exists("/some/file")
):
	if ( ! -e "/some/file" )       if ( not
os.path.exists("/some/file") ):

     Also, the language is so OOP-y, it's like having to specify
absolute paths
     to everything.. makes for redundancy that clutters up code quickly:

	if ( os.path.isdir(foo) ): ..
	if ( os.path.isdir(bar) ): ..
	if ( os.path.isdir(bla) ): ..

     ..all that "os.path" stuff seems redundant readability wise,
     harder to read than the csh/perl equivalent:

	if ( -d $foo ) ..
	if ( -d $bar ) ..
	if ( -d $bla ) ..

     I also miss being able to easily embed variables in strings,
     making commands with lots of arguments harder to read in Python:
	
	$render -f $somefile $sfrm $efrm
# Csh
	system("$render -f $somefile $sfrm $efrm");
# Perl
	os.system(render+" -f "+somefile+" "+str(sfrm)+" "+str(efrm))
# Python

     ..all those (")s and (+)s and str()s make scripting way more
difficult
     than it needs to be.

     Also, I'd really miss being able to do assignments within
conditionals
     something I do often in Perl and C:

         PERL/C                               PYTHON
	while ( $foo = ReadStuff() ) ..      while (1): foo =
ReadStuff(); if ( not foo ): break; ..
	if ( $foo = IsOkay() ) ..            foo = IsOkay(); if ( foo ):
..

     And all those icky ':'s on the end of if/else/while
     seem unnecessary if line breaks are present. In a language where
     white space is significant, I think it would help here.

     I don't mind the whitespace indenting thing as much as I thought I
would,
     and not having to specify $ in front of variables is nice, though
not nice enough
     to loose the ability to embed variables in strings. Would be neat
if Python
     would allow '$'s to be used to expand variables in strings, instead
of that
     icky "%(var)s" syntax.



Last Next