#python - Sun 18 Feb 2007 between 08:05 and 08:17

NY Lost Funds



tkpopenembedded
ayazthe $? variable is enviornment dependent.
tkp( a cross-compiling build system - built in python)
right...
but this python script get run in a sepperate shell instance
ayazif you have two shell instances, then they both run in separate enviornments
tkphold on...
openembedded has routines like do_compile()... do_configure()
eache of these is a shellscript
which gets set up with a specific set of env vars
within the do_compile() routine... I run a whole load of shell commands.... eg { cd ${} ; ls ; python myscript.py | echo $? }
see - it's all done in the same scell env
shell*
yet the $? lways yeilds 0
ayazif the application or set of applications is spawning processes in different shells, then relying on $? for exit status is unreliable
tkpalways*
any sugestions?
hold on... the as you can see tho... where I run the python script and where I test $? is all in the same shell
it has the same env
ayazoh
janembahello
ayaztkp: are you sure myscript.py is exiting with a different exit status code than 0?
tkpIt does sys.exit(1) in the code... unless... there is a signl hndler of sorts capturing the exit status and modifying it?
janembaWhen we import package we can make this "from foo import *" but if foo contain only class files, import will import only the files can I import the contents without explictly called them (ex: from foo import *.*)
?
tkpas a test I just tried this in do_compile - the same place where I'm attempting to catch the exit status code from my pyton app...
ls /erere || echo $?
it prints 2
ayazhmmm
tkpsince the dir does not exist
so it's not a shell/env problem
ayaztkp: i am not sure what's happening there exactly
tkpcan you attache handlers to catch sys.exit() calls and modify them?
catch*
ayazi don't know.
tkpattach* - excuse me... my 'a' key is broken on my keyboard
ayazjanemba: i am not sure. you could test it out. ;)
tkp: there must be another way around to it than relying on $?
tkpayaz: not really - at lest, I can't think of one
how else to test if a python script compleeted successfully

Page: 4 11 18 25 32 39 

IrcArchive

NY Lost Funds