Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Test: Difference between revisions

From Randomness wiki
mNo edit summary
 
Line 1: Line 1:


This is a text article
This is a test article
<syntaxhighlight lang="python">
# You can syntax highlight code
def compacttrace(exc: Exception, maxamount: int = 100):
    out = []
    for a in range(maxamount):
        line = exc.__traceback__.tb_lineno
        file =  exc.__traceback__.tb_frame.f_code.co_filename
        out.append(f"{exc!a} # line {line} file {file}")
        if exc.__cause__:
            out.append("# Caused")
        elif exc.__context__:
            out.append("# Happened")
        exc = exc.__context__
        if not exc:
            break
    return "\n".join(reversed(out))
 
try:
    try:
        try:
            1 / 0
        except:
            ashj4et
    except Exception as e:
        raise ValueError("no") from e
except:
  #traceback.print_exc()
    print(compacttrace(sys.exc_info()[1]))
</syntaxhighlight>


== Basic stuff ==
== Basic stuff ==
Line 60: Line 31:
</pre>
</pre>


== Advanced
== Advanced ==


Link to page [[.conkyrc]]
Link to page [[.conkyrc]]
Line 67: Line 38:


<nowiki>You can use the <nowiki> tag to escape stuff</nowiki>
<nowiki>You can use the <nowiki> tag to escape stuff</nowiki>
<syntaxhighlight lang="python">
# You can syntax highlight code
def compacttrace(exc: Exception, maxamount: int = 100):
    out = []
    for a in range(maxamount):
        line = exc.__traceback__.tb_lineno
        file =  exc.__traceback__.tb_frame.f_code.co_filename
        out.append(f"{exc!a} # line {line} file {file}")
        if exc.__cause__:
            out.append("# Caused")
        elif exc.__context__:
            out.append("# Happened")
        exc = exc.__context__
        if not exc:
            break
    return "\n".join(reversed(out))
try:
    try:
        try:
            1 / 0
        except:
            ashj4et
    except Exception as e:
        raise ValueError("no") from e
except:
  #traceback.print_exc()
    print(compacttrace(sys.exc_info()[1]))
</syntaxhighlight>

Latest revision as of 22:42, 14 September 2024

This is a test article

Basic stuff

italic bold bold and italic

Line


Below line

  • list unordered
  • another element
    • deeper
      • even deeper
  1. one
  2. two
  3. three
this
is
indented
mew mew 
mew mew
mew mew

Advanced

Link to page .conkyrc

External [YeenBlog]

You can use the <nowiki> tag to escape stuff

# You can syntax highlight code
def compacttrace(exc: Exception, maxamount: int = 100):
    out = []
    for a in range(maxamount):
        line = exc.__traceback__.tb_lineno
        file =  exc.__traceback__.tb_frame.f_code.co_filename
        out.append(f"{exc!a} # line {line} file {file}")
        if exc.__cause__:
            out.append("# Caused")
        elif exc.__context__:
            out.append("# Happened")
        exc = exc.__context__
        if not exc:
            break
    return "\n".join(reversed(out))

try:
    try:
        try:
            1 / 0
        except:
            ashj4et
    except Exception as e:
        raise ValueError("no") from e
except:
   #traceback.print_exc()
    print(compacttrace(sys.exc_info()[1]))