Skip to content

Instantly share code, notes, and snippets.

@dicato
Created July 31, 2012 21:25
Show Gist options
  • Save dicato/3220727 to your computer and use it in GitHub Desktop.
Save dicato/3220727 to your computer and use it in GitHub Desktop.
Illustrate exception fix for Intellect
from intellect.Intellect import Intellect
if __name__ == '__main__':
test_intellect = Intellect()
# This should throw a generic exception
try:
test_intellect.learn('/path/to/bad/file.policy')
except Exception:
print "Caught a generic exception"
# This should work
test_intellect.learn("""
rule always_fire:
then:
print("hello world!!!!")
""")
# This should throw a generic exception
try:
test_intellect.learn("""
This is a bad policy!
""")
except Exception:
print "Caught a generic exception"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment