Off the top of my head, I'm guessing that you are catching 'warning' exceptions. It is generally not a good idea to catch all exceptions like you are doing, because you pass up on unexpected or unintended exceptions. When you use 'except' by itself, you are doing just that. If you think that you might run into cases where the file does not exist, do except(IOError), for that specific case, and add other exceptions classes as needed.
On Sat, Jan 18, 2014 at 10:05 AM, Jep Hill <[email protected]> wrote: > Ok, I probably could have worded my last post a bit better and provided an > actual python test since, after all, this is a PYTHON board. Here's a bit > more info to shed light on my issue: > > I have a script that is pointing to some missing media and missing gizmos -- > so I expect warnings and errors. When I do the following, I am able to open > it via a shell interactive prompt and work with it: > > nuke -t > nuke.scriptOpen("myNukeScript.nk") > > Even though there are warnings/errors about missing image sequences, it does > allow me to continue on in interactive mode... > > However, if make a simple python function named openTest.py: > > ### openTest.py > > import nuke > import os > > > def main(): > nk = os.path.abspath(sys.argv[1]) > try: > nuke.scriptOpen(nk) > except: > print "Unable to open file" > else: > ### do stuff to script... > > if __name__ == '__main__': > main() > > ### end > > > then execute it as such: > > nuke -t openTest.py myNukeScript.nk > > I hit the the exception and get my message: "Unable to open file" > > Question: How can I get the script to Open via python so I can continue to do > things to it? > > > If it opens in my first example, it should absolutely open in the second... > Thoughts? > > > Cheers, > Jep_______________________________________________ > Nuke-python mailing list > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python -- Jose Fernandez de Castro _______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
