Changes between Version 30 and Version 31 of PyYAMLDocumentation
- Timestamp:
- 06/19/06 13:09:58 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PyYAMLDocumentation
v30 v31 297 297 }}} 298 298 299 299 300 The default representation for '''`Dice`''' objects is not nice: 300 301 {{{ … … 416 417 - APL 417 418 - ASP 419 418 420 - Assembly 419 421 - Awk … … 984 986 985 987 986 === YAMLError ===987 988 {{{989 #!python990 YAMLError()991 }}}992 993 If YAML parser encounters an error condition, it raises an exception which is an instance of994 '''`YAMLError`''' or of its subclass. An application may catch this exception and warn a user.995 {{{996 #!python997 try:998 config = yaml.load(file('config.yaml', 'r'))999 except yaml.YAMLError, exc:1000 print "Error in configuration file:", exc1001 }}}1002 1003 1004 988 === Mark === 1005 989 {{{ … … 1013 997 '''`buffer`''', when it is not `None`, is a part of the input stream that contain the position 1014 998 and '''`pointer`''' refers to the position in the `buffer`. 999 1000 1001 === YAMLError === 1002 1003 {{{ 1004 #!python 1005 YAMLError() 1006 }}} 1007 1008 If the YAML parser encounters an error condition, it raises an exception which is an instance of 1009 '''`YAMLError`''' or of its subclass. An application may catch this exception and warn a user. 1010 {{{ 1011 #!python 1012 try: 1013 config = yaml.load(file('config.yaml', 'r')) 1014 except yaml.YAMLError, exc: 1015 print "Error in configuration file:", exc 1016 }}} 1017 1018 An exception produced produced by the YAML processor may point to the problematic position. 1019 {{{ 1020 #!python 1021 >>> try: 1022 ... yaml.load("unbalanced blackets: ][") 1023 ... except yaml.YAMLError, exc: 1024 ... if hasattr(exc, 'problem_mark'): 1025 ... mark = exc.problem_mark 1026 ... print "Error position: (%s:%s)" % (mark.line+1, mark.column+1) 1027 1028 Error position: (1:22) 1029 }}} 1015 1030 1016 1031 … … 1123 1138 TagToken(value=(u'!!', u'int')) 1124 1139 ScalarToken(plain=False, style="'", value=u'5') 1140 1125 1141 BlockEntryToken() 1126 1142 AliasToken(value=u'A')
