[Radiance-general] translate UNIX command into Windows command

David Smith dbs176 at gmail.com
Tue Jul 27 06:25:13 PDT 2010


Ji,

Python is quotes-agnostic, so long as you start and end with the same type,
it doesn't matter what's in between. In other words, you can use
double_quote='"' to store the " character, or single_quote="'" to store the
' character. To save the string "', you'd have to do something like
both_quotes='"'+"'". Triple quotes are for multiline strings (and comments).

Additionally, I think you'd need a pipe, which might not be Windows
friendly, or an intermediate file.

Your command would be:


#! /bin/python

import os

#with pipe
rtrace_command1 = 'rtrace -I -ab 1 -h -w -oov -u- scene.oct < sensor.pts | '
+\
                  'rcalc -e
"$1=$1;$2=$2;$3=$3;$4=179*(.265*$4+.670*$5+.065*$6)" > result.dat'

#with intermediate file
rtrace_command2a = 'rtrace -I -ab 1 -h -w -oov -u- scene.oct < sensor.pts >
tmp.file'
rtrace_command2b = 'rcalc -e
"$1=$1;$2=$2;$3=$3;$4=179*(.265*$4+.670*$5+.065*$6)" < tmp.file >
result.dat'


#should be equivalent:
os.system(rtrace_command1)

os.system(rtrace_command2a)
os.system(rtrace_command2b)



--Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://radiance-online.org/pipermail/radiance-general/attachments/20100727/6f01a0a4/attachment.htm


More information about the Radiance-general mailing list