Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
checking that an object exists

checking that an object exists

2005-04-07       - By Bernard Lebel

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

I do agree with most of that. Exception handling makes lazy code.
Still, there are some times where you absolutely need the code to run
no matter what, either because you don't have time to write proper
error-checking, or because there is just no other way to make the
program complete.


Here is case where try/catch saved my arse, probably because I didn't
have enough scripting knowledge to pull off the task without it:

At Action Synth�se we were using map files for all textures. Because
it involved a problematic network overhead, it was decided to copy the
character textures onto each render farm client (wich had a BatchServe
function telling them to substitute the network path by a local one at
load time).

However the problem is that I had 8 gigs of textures to copy on 125
machines. You can understand that this could not be done within an
hour, but rather few hours, even with several machines contributing to
this copy. I didn't have the technical knowledge to tell each machine
to perform their own copy *in an efficient manner* (ie other than
logging on VNC and remotely lauch 125 copies.... I didn't feel like
staying up very late for this, plus it would have been prone to human
errors).

Obivously a script to do that was the best way to handle this. However
the problem was that Windows being Windows, there was some boxes where
permission to copy to was denied (denied only when performing a
scripted copy, doing it by hand would yield no problem at all), even
though I was logged as domain administrator. When that happened, the
copy would fail, throwing an error and thus stopping the script. This
could not be afforded.

Since I was in a hurry and didn't feel like searching
permission-faulty boxes (wich were subject to mysterious changes
anyway), putting the copy operation in a try-catch statement was the
most reliable way to go. The catch statement would then print the
faulty machine name, and the next morning I could simply manually copy
the textures on these boxes, wich fortunately was less then 10.




Another case is with scripting shaders. I once wrote a script that
would make changes to every Image and Bumpmap_generator shaders in the
scene. But for the life of me, the script would crash on some shaders.
I was just never able to find what the hell was happening, and I had
lots of objects to edit this way (with the clock running), so again
the try-catch thing saved my day.



Finally, I should add that although I don't know much about
performance, exceptions in Python is just pure joy (would be long
winded to go through this but let's just say there is so much you can
do in this area it's crazy). It is very tempting in Python to fall
onto this type of flow control.



Cheers
Bernard


On Apr 7, 2005 4:06 PM, Brad Friedman <xsibrad@(protected)> wrote:
> And also, once you get
> into the habbit of frowning upon exceptions... its hard to stop :) err... :(

---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi