Question #202307 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/202307
Roman Podolyan proposed the following answer: > 1. How should i transform it into a function > 2. If that function fails, i want to skip it and move to next steps. Don't know why you want this (if import fails - functions from that module can't be called... maybe some test question? :) ), but I did some research and found that it is possible to make skippable import in Python(Jython). So the code is: def importfail(): try: import blahblahblah except ImportError: popup('Blah-blah-blah import failed!') importfail() See version with indentation and highlighted syntax here: http://pastebin.com/qSA6kmy3 I tested the code in Sikuli X RC3+ (R930). Because module blahblahblah doesn't exist (of course, cap) - function produces pop-up. If you want just to skip import - replace "popup('Blah-blah-blah import failed!')" statement with "pass" keyword for doing nothing. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. _______________________________________________ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp