From 51b82ca9edcc8241b8e16b8b8dd0e689a2320176 Mon Sep 17 00:00:00 2001 From: Divi Schmidt Date: Sun, 24 Oct 2021 20:11:51 -0700 Subject: [PATCH 1/4] added logging for linenumber, bytecode, and a traceback summary and an example csv --- Examples.ipynb | 355 +++++++++++++++++++++++++++++++++++++++++++------ d8error.py | 57 +++++--- errorLog.csv | 11 ++ 3 files changed, 364 insertions(+), 59 deletions(-) create mode 100644 errorLog.csv diff --git a/Examples.ipynb b/Examples.ipynb index 3c6e7ab..ce8f90f 100644 --- a/Examples.ipynb +++ b/Examples.ipynb @@ -3,7 +3,6 @@ { "cell_type": "code", "execution_count": 1, - "id": "ed6b8ee0-85af-4bf7-a905-2b3fcfbe2de4", "metadata": {}, "outputs": [], "source": [ @@ -16,7 +15,16 @@ { "cell_type": "code", "execution_count": 2, - "id": "cb6d1a23-31c7-4c57-a3f4-0c37d541dab2", + "metadata": {}, + "outputs": [], + "source": [ + "%load_ext autoreload\n", + "%autoreload 2" + ] + }, + { + "cell_type": "code", + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -90,7 +98,22 @@ " {\n", " \"not callable\": {\n", " \"helptext\": [\n", - " \"Using a variable or object that isn't a function but using it as one, i.e `3(2)`, in this case we are using 3 as a function, if you wanted to multiply you need `3*(2)`\"\n", + " \"Using a variable or object that isn't a function but using it as one, i.e `3(2)`, in this case we are using 3 as a function, if you wanted to multiply you need `3*(2)`\",\n", + " \"Using `tbl.columns` instead of `tbl.column`\"\n", + " ]\n", + " }\n", + " },\n", + " {\n", + " \"positional arguments\": {\n", + " \"helptext\": [\n", + " \"Using a function that takes in a different number of arguments than provided\"\n", + " ]\n", + " }\n", + " },\n", + " {\n", + " \"not supported between\": {\n", + " \"helptext\": [\n", + " \"Using two different incompatible object types in an operation like comparison, `3 == [3,3]`. Notice here we want to use a list and number, but this kind of operation isn't allowed, one needs to convert to array with `make_array` or review the problem specifications\"\n", " ]\n", " }\n", " }\n", @@ -102,6 +125,22 @@ " \"Converting something that cannot be converted, i.e `int(\\\"HELLO WORLD!!\\\")`\"\n", " ]\n", " }\n", + " },\n", + " {\n", + " \"not in the table\": {\n", + " \"helptext\": [\n", + " \"Misspelling a column label, or using a column name that isn't in the table\"\n", + " ]\n", + " }\n", + " }\n", + " ],\n", + " \"ZeroDivisionError\": [\n", + " {\n", + " \"division by zero\": {\n", + " \"helptext\": [\n", + " \"Using the division symbol '/' where the denominator is 0 or a variable set to 0.\"\n", + " ]\n", + " }\n", " }\n", " ]\n", "}\n" @@ -116,10 +155,21 @@ }, { "cell_type": "code", - "execution_count": 3, - "id": "bc34ba17-3315-404d-89c8-5cdaa201d405", - "metadata": {}, + "execution_count": 4, + "metadata": { + "scrolled": true + }, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "<>:1: SyntaxWarning: 'int' object is not callable; perhaps you missed a comma?\n", + "<>:1: SyntaxWarning: 'int' object is not callable; perhaps you missed a comma?\n", + ":1: SyntaxWarning: 'int' object is not callable; perhaps you missed a comma?\n", + " 3(2)\n" + ] + }, { "data": { "text/markdown": [ @@ -156,6 +206,18 @@ "metadata": {}, "output_type": "display_data" }, + { + "data": { + "text/markdown": [ + "2. Using `tbl.columns` instead of `tbl.column`" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, { "data": { "text/markdown": [ @@ -200,7 +262,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m3\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;36m3\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mTypeError\u001b[0m: 'int' object is not callable" ] } @@ -211,8 +273,7 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "e111050d-72e0-4535-901b-68edcfd64bd7", + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -296,7 +357,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhello\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhello\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m: 'NoneType' object has no attribute 'hello'" ] } @@ -308,10 +369,22 @@ }, { "cell_type": "code", - "execution_count": 5, - "id": "ea5ab99d-f418-4c3b-a7e8-964ebffa3cd8", + "execution_count": 6, "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n" + ] + }, { "data": { "text/markdown": [ @@ -416,19 +489,32 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdata8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0mdata8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mNameError\u001b[0m: name 'data8' is not defined" ] } ], "source": [ + "print()\n", + "\n", + "print()\n", + "\n", + "print()\n", + "\n", + "print()\n", + "\n", + "print()\n", + "\n", + "print()\n", + "\n", + "print()\n", + "\n", "data8" ] }, { "cell_type": "code", - "execution_count": 6, - "id": "daad724d-b183-4e14-bd52-c6b4fcd5def8", + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -518,10 +604,10 @@ }, { "ename": "SyntaxError", - "evalue": "invalid syntax (, line 1)", + "evalue": "invalid syntax (, line 1)", "output_type": "error", "traceback": [ - "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 2a\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m 2a\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" ] } ], @@ -531,8 +617,7 @@ }, { "cell_type": "code", - "execution_count": 7, - "id": "e0b65220-e599-4818-91d5-b14eaf62f494", + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -627,8 +712,8 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maragne\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'HI'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/opt/anaconda3/lib/python3.7/site-packages/numpy/__init__.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(attr)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m raise AttributeError(\"module {!r} has no attribute \"\n\u001b[0;32m--> 215\u001b[0;31m \"{!r}\".format(__name__, attr))\n\u001b[0m\u001b[1;32m 216\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__dir__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maragne\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'HI'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/usr/local/lib/python3.8/site-packages/numpy/__init__.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(attr)\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mTester\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 218\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 219\u001b[0;31m raise AttributeError(\"module {!r} has no attribute \"\n\u001b[0m\u001b[1;32m 220\u001b[0m \"{!r}\".format(__name__, attr))\n\u001b[1;32m 221\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mAttributeError\u001b[0m: module 'numpy' has no attribute 'aragne'" ] } @@ -639,8 +724,7 @@ }, { "cell_type": "code", - "execution_count": 8, - "id": "dc82d397-919c-40f0-9ebd-2285d0c243b2", + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -723,7 +807,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mIndexError\u001b[0m: list index out of range" ] } @@ -734,8 +818,7 @@ }, { "cell_type": "code", - "execution_count": 9, - "id": "890c3625-e661-4ab5-9591-9ced52fc678f", + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -830,8 +913,8 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/opt/anaconda3/lib/python3.7/site-packages/numpy/__init__.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(attr)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m raise AttributeError(\"module {!r} has no attribute \"\n\u001b[0;32m--> 215\u001b[0;31m \"{!r}\".format(__name__, attr))\n\u001b[0m\u001b[1;32m 216\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__dir__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhi\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/usr/local/lib/python3.8/site-packages/numpy/__init__.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(attr)\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mTester\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 218\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 219\u001b[0;31m raise AttributeError(\"module {!r} has no attribute \"\n\u001b[0m\u001b[1;32m 220\u001b[0m \"{!r}\".format(__name__, attr))\n\u001b[1;32m 221\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mAttributeError\u001b[0m: module 'numpy' has no attribute 'hi'" ] } @@ -842,8 +925,7 @@ }, { "cell_type": "code", - "execution_count": 10, - "id": "335e2749-a9a7-4f93-af12-fa74caba755b", + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -950,7 +1032,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mTable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mTable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mNameError\u001b[0m: name 'Table' is not defined" ] } @@ -961,8 +1043,7 @@ }, { "cell_type": "code", - "execution_count": 11, - "id": "e9fadb61-6c6c-46a4-aeb6-656d77b3b2e6", + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -1045,7 +1126,7 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"HI\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"HI\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;31mValueError\u001b[0m: invalid literal for int() with base 10: 'HI'" ] } @@ -1056,24 +1137,214 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "683cc281-1ee1-4ca8-9b40-4ace288fe2ce", + "execution_count": 13, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/markdown": [ + "## **Uh-o it seems we have an error!**" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "It seems we have a ZeroDivisionError. ZeroDivisionErrors are usually because of:" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "1. Using the division symbol '/' where the denominator is 0 or a variable set to 0." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "The Data 8 Reference might be helpful to look over for examples and usage: [Data 8 Reference](http://data8.org/fa21/python-reference.html)" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "If you are having more trouble please feel free to consult a staff member at [Office Hours](https://oh.data8.org) \n", + " or see the error message below " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "Please fill out this quick survey to help us improve the the error feedback [Data 8 Error Feedback Survey](https://forms.gle/6UZQjwZmAxVDMsBR6)" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "ename": "ZeroDivisionError", + "evalue": "division by zero", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;36m3\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36mf\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;36m3\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" + ] + } + ], + "source": [ + "def f():\n", + " 3 / 0\n", + " return\n", + "f()" + ] + }, + { + "cell_type": "code", + "execution_count": 14, "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/markdown": [ + "## **Uh-o it seems we have an error!**" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "It seems we have a ZeroDivisionError. ZeroDivisionErrors are usually because of:" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "1. Using the division symbol '/' where the denominator is 0 or a variable set to 0." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "The Data 8 Reference might be helpful to look over for examples and usage: [Data 8 Reference](http://data8.org/fa21/python-reference.html)" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "If you are having more trouble please feel free to consult a staff member at [Office Hours](https://oh.data8.org) \n", + " or see the error message below " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/markdown": [ + "Please fill out this quick survey to help us improve the the error feedback [Data 8 Error Feedback Survey](https://forms.gle/6UZQjwZmAxVDMsBR6)" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "ename": "ZeroDivisionError", + "evalue": "division by zero", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36mf\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;36m3\u001b[0m \u001b[0;34m/\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" + ] + } + ], + "source": [ + "f()" + ] }, { "cell_type": "code", "execution_count": null, - "id": "a1c3ab1a-8c8a-4661-9d89-8ddcc1ed9c39", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "import numpy as np\n", + "\n", + "arr = np.zeros(6)\n", + "np.ones(6) / arr" + ] }, { "cell_type": "code", "execution_count": null, - "id": "d941bac9-af16-47d8-8182-37709ef1b4f0", "metadata": {}, "outputs": [], "source": [] @@ -1095,7 +1366,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.10" + "version": "3.8.11" } }, "nbformat": 4, diff --git a/d8error.py b/d8error.py index b175f9f..3b8f5a5 100644 --- a/d8error.py +++ b/d8error.py @@ -4,12 +4,12 @@ import csv import ipywidgets as widgets import datetime - +import traceback class Announce: """error index, serves as an id on the csv file""" eindex = 0 - def __init__(self, etype, value): + def __init__(self, etype, value, tb, tb_offset=None): self.eindex = Announce.eindex Announce.eindex += 1 self.etype = etype @@ -17,6 +17,8 @@ def __init__(self, etype, value): self.feedbackRating = 0 self.feedbackMSG = "" self.errorname = str(etype().__class__.__name__) + self.tb = tb + self.tb_offset = tb_offset with open("errorConfig.json", "r") as f: diction = json.load(f) exceptionClass = diction.get(self.errorname) @@ -32,20 +34,31 @@ def __init__(self, etype, value): prewrittenMessge = True self.print = prewrittenMessge - def writeRow(file): - """saves errors to errorLog.csv""" - fieldnames = ['index', 'errorType', 'errorMSG', 'feedbackRating', 'feedbackMSG', "Time"] - writer = csv.DictWriter(file, fieldnames=fieldnames) - writer.writerow({"index": self.eindex, - "errorType": self.errorname, - "errorMSG": str(self.value), - "feedbackRating": self.feedbackRating, - "feedbackMSG": self.feedbackMSG, - "Time": str(datetime.datetime.now())}) - + # this generates a semi-readable summary of the traceback, which includes some information about the python code that caused the error + summary = traceback.extract_tb(tb).format() + + # iterate through traceback object to extract linenumber and bytecode + curr_tb = tb.tb_next # skip the first frame which is the jupyter notebook frame + linenos = [] + bytecodes = [] + while curr_tb: + linenos.append(curr_tb.tb_lineno) + bytecodes.append(curr_tb.tb_frame.f_code.co_code) + curr_tb = curr_tb.tb_next + if not os.path.isfile("errorLog.csv"): with open('errorLog.csv', 'w', newline='') as f: - writeRow(f) + fieldnames = ['index', 'errorType', 'errorMSG', 'feedbackRating', 'feedbackMSG', 'time', 'lineNums', 'bytecodes', 'traceSummary'] + writer = csv.DictWriter(f, fieldnames=fieldnames) + writer.writerow({"index": self.eindex, + "errorType": self.errorname, + "errorMSG": str(self.value), + "feedbackRating": self.feedbackRating, + "feedbackMSG": self.feedbackMSG, + "Time": str(datetime.datetime.now()), + "lineNums": linenos, + "bytecodes": bytecodes, + "traceSummary":summary}) else: if Announce.eindex == 1: with open("errorLog.csv", 'r') as f: @@ -54,7 +67,17 @@ def writeRow(file): self.eindex += 1 Announce.eindex = self.eindex + 1 with open('errorLog.csv', 'a', newline='') as f: - writeRow(f) + fieldnames = ['index', 'errorType', 'errorMSG', 'feedbackRating', 'feedbackMSG', 'time', 'lineNums', 'bytecodes', 'traceSummary'] + writer = csv.DictWriter(f, fieldnames=fieldnames) + writer.writerow({"index": self.eindex, + "errorType": self.errorname, + "errorMSG": str(self.value), + "feedbackRating": self.feedbackRating, + "feedbackMSG": self.feedbackMSG, + "Time": str(datetime.datetime.now()), + "lineNums": linenos, + "bytecodes": bytecodes, + "traceSummary":summary}) def tips(self): etype = self.etype @@ -64,12 +87,12 @@ def tips(self): exceptionClass = diction.get(self.errorname) if exceptionClass is not None: self.default() + for i in exceptionClass: key, items = list(i.items())[0] if (key in str(value)): c=1 for j in items.get("helptext"): - display(Markdown(str(c)+". "+j)) c += 1 def data8(self): @@ -146,7 +169,7 @@ def on_btn_click(b): def test_exception(self, etype, value, tb, tb_offset=None): try: - announce = Announce(etype, value) + announce = Announce(etype, value, tb, tb_offset) if announce.print: announce.title() announce.tips() diff --git a/errorLog.csv b/errorLog.csv new file mode 100644 index 0000000..d6e412f --- /dev/null +++ b/errorLog.csv @@ -0,0 +1,11 @@ +TypeError,'int' object is not callable,[1],[b'd\x00d\x01\x83\x01F\x00d\x02S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n 3(2)\n']" +AttributeError,'NoneType' object has no attribute 'hello',[2],[b'e\x00j\x01F\x00d\x00S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 2, in \n a.hello\n']" +NameError,name 'data8' is not defined,[15],[b'e\x00F\x00d\x00S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 15, in \n data8\n']" +SyntaxError,"invalid syntax (, line 1)",[101],[b't\x00|\x01|\x02|\x03|\x00j\x01t\x02B\x00d\x01\x83\x05S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3116, in run_cell_async\n code_ast = compiler.ast_parse(cell, filename=cell_name)\n', ' File ""/usr/local/lib/python3.8/site-packages/IPython/core/compilerop.py"", line 101, in ast_parse\n return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)\n']" +AttributeError,module 'numpy' has no attribute 'aragne',"[1, 219]","[b'e\x00\xa0\x01d\x00\xa1\x01F\x00d\x01S\x00', b'|\x00d\x01k\x02r\x18d\x02d\x00l\x00m\x01}\x01\x01\x00|\x01S\x00|\x00d\x03k\x02r0d\x04d\x05l\x01m\x02}\x02\x01\x00|\x02S\x00t\x03d\x06\xa0\x04t\x05|\x00\xa1\x02\x83\x01\x82\x01d\x00S\x00']","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n np.aragne(\'HI\')\n', ' File ""/usr/local/lib/python3.8/site-packages/numpy/__init__.py"", line 219, in __getattr__\n raise AttributeError(""module {!r} has no attribute ""\n']" +IndexError,list index out of range,[1],[b'd\x00g\x01d\x01\x19\x00F\x00d\x02S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n [2][1]\n']" +AttributeError,module 'numpy' has no attribute 'hi',"[1, 219]","[b'e\x00j\x01F\x00d\x00S\x00', b'|\x00d\x01k\x02r\x18d\x02d\x00l\x00m\x01}\x01\x01\x00|\x01S\x00|\x00d\x03k\x02r0d\x04d\x05l\x01m\x02}\x02\x01\x00|\x02S\x00t\x03d\x06\xa0\x04t\x05|\x00\xa1\x02\x83\x01\x82\x01d\x00S\x00']","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n np.hi\n', ' File ""/usr/local/lib/python3.8/site-packages/numpy/__init__.py"", line 219, in __getattr__\n raise AttributeError(""module {!r} has no attribute ""\n']" +NameError,name 'Table' is not defined,[1],[b'e\x00\x83\x00F\x00d\x00S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n Table()\n']" +ValueError,invalid literal for int() with base 10: 'HI',[1],[b'e\x00d\x00\x83\x01F\x00d\x01S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n int(""HI"")\n']" +ZeroDivisionError,division by zero,"[4, 2]","[b'e\x00\x83\x00F\x00d\x00S\x00', b'd\x01d\x02\x1b\x00\x01\x00d\x00S\x00']","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 4, in \n f()\n', ' File """", line 2, in f\n 3 / 0\n']" +ZeroDivisionError,division by zero,"[1, 2]","[b'e\x00\x83\x00F\x00d\x00S\x00', b'd\x01d\x02\x1b\x00\x01\x00d\x00S\x00']","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n f()\n', ' File """", line 2, in f\n 3 / 0\n']" From 7a9e5903dfd14395e583157a504305e563c0600a Mon Sep 17 00:00:00 2001 From: Divi Schmidt Date: Sun, 7 Nov 2021 14:28:58 -0800 Subject: [PATCH 2/4] modified logging to log only first and second traceback frames --- Examples.ipynb | 16 +++++++++++++ d8error.py | 64 ++++++++++++++++++++------------------------------ errorLog.csv | 25 +++++++++++--------- 3 files changed, 55 insertions(+), 50 deletions(-) diff --git a/Examples.ipynb b/Examples.ipynb index ce8f90f..f92a4eb 100644 --- a/Examples.ipynb +++ b/Examples.ipynb @@ -3,6 +3,7 @@ { "cell_type": "code", "execution_count": 1, + "id": "5d903700", "metadata": {}, "outputs": [], "source": [ @@ -15,6 +16,7 @@ { "cell_type": "code", "execution_count": 2, + "id": "05cbb742", "metadata": {}, "outputs": [], "source": [ @@ -25,6 +27,7 @@ { "cell_type": "code", "execution_count": 3, + "id": "a168489c", "metadata": {}, "outputs": [ { @@ -156,6 +159,7 @@ { "cell_type": "code", "execution_count": 4, + "id": "fbda9a93", "metadata": { "scrolled": true }, @@ -274,6 +278,7 @@ { "cell_type": "code", "execution_count": 5, + "id": "98c125a4", "metadata": {}, "outputs": [ { @@ -370,6 +375,7 @@ { "cell_type": "code", "execution_count": 6, + "id": "bd62faf1", "metadata": {}, "outputs": [ { @@ -515,6 +521,7 @@ { "cell_type": "code", "execution_count": 7, + "id": "c9b217f8", "metadata": {}, "outputs": [ { @@ -618,6 +625,7 @@ { "cell_type": "code", "execution_count": 8, + "id": "d73343ab", "metadata": {}, "outputs": [ { @@ -725,6 +733,7 @@ { "cell_type": "code", "execution_count": 9, + "id": "f9e7d54b", "metadata": {}, "outputs": [ { @@ -819,6 +828,7 @@ { "cell_type": "code", "execution_count": 10, + "id": "6bcd7e86", "metadata": {}, "outputs": [ { @@ -926,6 +936,7 @@ { "cell_type": "code", "execution_count": 11, + "id": "be3e9ff0", "metadata": {}, "outputs": [ { @@ -1044,6 +1055,7 @@ { "cell_type": "code", "execution_count": 12, + "id": "e2e79aed", "metadata": {}, "outputs": [ { @@ -1138,6 +1150,7 @@ { "cell_type": "code", "execution_count": 13, + "id": "c7a1a8ab", "metadata": { "scrolled": true }, @@ -1238,6 +1251,7 @@ { "cell_type": "code", "execution_count": 14, + "id": "3522fe1f", "metadata": {}, "outputs": [ { @@ -1333,6 +1347,7 @@ { "cell_type": "code", "execution_count": null, + "id": "51d8fd23", "metadata": {}, "outputs": [], "source": [ @@ -1345,6 +1360,7 @@ { "cell_type": "code", "execution_count": null, + "id": "5c3a5e19", "metadata": {}, "outputs": [], "source": [] diff --git a/d8error.py b/d8error.py index 3b8f5a5..c6059d9 100644 --- a/d8error.py +++ b/d8error.py @@ -37,47 +37,33 @@ def __init__(self, etype, value, tb, tb_offset=None): # this generates a semi-readable summary of the traceback, which includes some information about the python code that caused the error summary = traceback.extract_tb(tb).format() - # iterate through traceback object to extract linenumber and bytecode + # iterate through traceback object to extract linenumber and bytecode of the first two frames curr_tb = tb.tb_next # skip the first frame which is the jupyter notebook frame - linenos = [] - bytecodes = [] - while curr_tb: - linenos.append(curr_tb.tb_lineno) - bytecodes.append(curr_tb.tb_frame.f_code.co_code) + bytecodesToLinenos = [] + while curr_tb and len(bytecodesToLinenos) < 2: + bytecodesToLinenos.append((curr_tb.tb_frame.f_code.co_code, curr_tb.tb_lineno)) curr_tb = curr_tb.tb_next - - if not os.path.isfile("errorLog.csv"): - with open('errorLog.csv', 'w', newline='') as f: - fieldnames = ['index', 'errorType', 'errorMSG', 'feedbackRating', 'feedbackMSG', 'time', 'lineNums', 'bytecodes', 'traceSummary'] - writer = csv.DictWriter(f, fieldnames=fieldnames) - writer.writerow({"index": self.eindex, - "errorType": self.errorname, - "errorMSG": str(self.value), - "feedbackRating": self.feedbackRating, - "feedbackMSG": self.feedbackMSG, - "Time": str(datetime.datetime.now()), - "lineNums": linenos, - "bytecodes": bytecodes, - "traceSummary":summary}) - else: - if Announce.eindex == 1: - with open("errorLog.csv", 'r') as f: - for row in csv.reader(f): - self.eindex = int(row[0]) - self.eindex += 1 - Announce.eindex = self.eindex + 1 - with open('errorLog.csv', 'a', newline='') as f: - fieldnames = ['index', 'errorType', 'errorMSG', 'feedbackRating', 'feedbackMSG', 'time', 'lineNums', 'bytecodes', 'traceSummary'] - writer = csv.DictWriter(f, fieldnames=fieldnames) - writer.writerow({"index": self.eindex, - "errorType": self.errorname, - "errorMSG": str(self.value), - "feedbackRating": self.feedbackRating, - "feedbackMSG": self.feedbackMSG, - "Time": str(datetime.datetime.now()), - "lineNums": linenos, - "bytecodes": bytecodes, - "traceSummary":summary}) + + + mode = 'w' if not os.path.isfile("errorLog.csv") else 'a' + if os.path.isfile("errorLog.csv") and Announce.eindex == 1: + with open("errorLog.csv", 'r') as f: + for row in csv.reader(f): + self.eindex = int(row[0]) + self.eindex += 1 + Announce.eindex = self.eindex + 1 + + with open('errorLog.csv', mode, newline='') as f: + fieldnames = ['index', 'errorType', 'errorMSG', 'feedbackRating', 'feedbackMSG', 'time', 'bytecodesToLinenos', 'traceSummary'] + writer = csv.DictWriter(f, fieldnames=fieldnames) + writer.writerow({"index": self.eindex, + "errorType": self.errorname, + "errorMSG": str(self.value), + "feedbackRating": self.feedbackRating, + "feedbackMSG": self.feedbackMSG, + "time": str(datetime.datetime.now()), + "bytecodesToLinenos": bytecodesToLinenos, + "traceSummary":summary}) def tips(self): etype = self.etype diff --git a/errorLog.csv b/errorLog.csv index d6e412f..6ca211e 100644 --- a/errorLog.csv +++ b/errorLog.csv @@ -1,11 +1,14 @@ -TypeError,'int' object is not callable,[1],[b'd\x00d\x01\x83\x01F\x00d\x02S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n 3(2)\n']" -AttributeError,'NoneType' object has no attribute 'hello',[2],[b'e\x00j\x01F\x00d\x00S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 2, in \n a.hello\n']" -NameError,name 'data8' is not defined,[15],[b'e\x00F\x00d\x00S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 15, in \n data8\n']" -SyntaxError,"invalid syntax (, line 1)",[101],[b't\x00|\x01|\x02|\x03|\x00j\x01t\x02B\x00d\x01\x83\x05S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3116, in run_cell_async\n code_ast = compiler.ast_parse(cell, filename=cell_name)\n', ' File ""/usr/local/lib/python3.8/site-packages/IPython/core/compilerop.py"", line 101, in ast_parse\n return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)\n']" -AttributeError,module 'numpy' has no attribute 'aragne',"[1, 219]","[b'e\x00\xa0\x01d\x00\xa1\x01F\x00d\x01S\x00', b'|\x00d\x01k\x02r\x18d\x02d\x00l\x00m\x01}\x01\x01\x00|\x01S\x00|\x00d\x03k\x02r0d\x04d\x05l\x01m\x02}\x02\x01\x00|\x02S\x00t\x03d\x06\xa0\x04t\x05|\x00\xa1\x02\x83\x01\x82\x01d\x00S\x00']","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n np.aragne(\'HI\')\n', ' File ""/usr/local/lib/python3.8/site-packages/numpy/__init__.py"", line 219, in __getattr__\n raise AttributeError(""module {!r} has no attribute ""\n']" -IndexError,list index out of range,[1],[b'd\x00g\x01d\x01\x19\x00F\x00d\x02S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n [2][1]\n']" -AttributeError,module 'numpy' has no attribute 'hi',"[1, 219]","[b'e\x00j\x01F\x00d\x00S\x00', b'|\x00d\x01k\x02r\x18d\x02d\x00l\x00m\x01}\x01\x01\x00|\x01S\x00|\x00d\x03k\x02r0d\x04d\x05l\x01m\x02}\x02\x01\x00|\x02S\x00t\x03d\x06\xa0\x04t\x05|\x00\xa1\x02\x83\x01\x82\x01d\x00S\x00']","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n np.hi\n', ' File ""/usr/local/lib/python3.8/site-packages/numpy/__init__.py"", line 219, in __getattr__\n raise AttributeError(""module {!r} has no attribute ""\n']" -NameError,name 'Table' is not defined,[1],[b'e\x00\x83\x00F\x00d\x00S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n Table()\n']" -ValueError,invalid literal for int() with base 10: 'HI',[1],[b'e\x00d\x00\x83\x01F\x00d\x01S\x00'],"[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n int(""HI"")\n']" -ZeroDivisionError,division by zero,"[4, 2]","[b'e\x00\x83\x00F\x00d\x00S\x00', b'd\x01d\x02\x1b\x00\x01\x00d\x00S\x00']","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 4, in \n f()\n', ' File """", line 2, in f\n 3 / 0\n']" -ZeroDivisionError,division by zero,"[1, 2]","[b'e\x00\x83\x00F\x00d\x00S\x00', b'd\x01d\x02\x1b\x00\x01\x00d\x00S\x00']","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n f()\n', ' File """", line 2, in f\n 3 / 0\n']" +1,TypeError,'int' object is not callable,0,,2021-11-07 15:55:34.668983,"[(b'd\x00d\x01\x83\x01F\x00d\x02S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n 3(2)\n']" +2,TypeError,'int' object is not callable,4,no,2021-11-07 15:55:45.702924,"[(b'd\x00d\x01\x83\x01F\x00d\x02S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n 3(2)\n']" +3,AttributeError,'NoneType' object has no attribute 'hello',5,no,2021-11-07 15:56:20.834872,"[(b'e\x00j\x01F\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 2, in \n a.hello\n']" +4,AttributeError,'NoneType' object has no attribute 'hello',4,yes,2021-11-07 15:56:27.532666,"[(b'e\x00j\x01F\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 2, in \n a.hello\n']" +5,TypeError,'int' object is not callable,0,,2021-11-07 15:57:31.542810,"[(b'd\x00d\x01\x83\x01F\x00d\x02S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n 3(2)\n']" +6,AttributeError,'NoneType' object has no attribute 'hello',0,,2021-11-07 15:57:34.956975,"[(b'e\x00j\x01F\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 2, in \n a.hello\n']" +7,NameError,name 'data8' is not defined,0,,2021-11-07 15:57:35.415077,"[(b'e\x00F\x00d\x00S\x00', 15)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 15, in \n data8\n']" +8,SyntaxError,"invalid syntax (, line 1)",0,,2021-11-07 15:57:35.598874,"[(b't\x00|\x01|\x02|\x03|\x00j\x01t\x02B\x00d\x01\x83\x05S\x00', 101)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3116, in run_cell_async\n code_ast = compiler.ast_parse(cell, filename=cell_name)\n', ' File ""/usr/local/lib/python3.8/site-packages/IPython/core/compilerop.py"", line 101, in ast_parse\n return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)\n']" +9,AttributeError,module 'numpy' has no attribute 'aragne',0,,2021-11-07 15:57:35.775996,"[(b'e\x00\xa0\x01d\x00\xa1\x01F\x00d\x01S\x00', 1), (b'|\x00d\x01k\x02r\x18d\x02d\x00l\x00m\x01}\x01\x01\x00|\x01S\x00|\x00d\x03k\x02r0d\x04d\x05l\x01m\x02}\x02\x01\x00|\x02S\x00t\x03d\x06\xa0\x04t\x05|\x00\xa1\x02\x83\x01\x82\x01d\x00S\x00', 219)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n np.aragne(\'HI\')\n', ' File ""/usr/local/lib/python3.8/site-packages/numpy/__init__.py"", line 219, in __getattr__\n raise AttributeError(""module {!r} has no attribute ""\n']" +10,IndexError,list index out of range,0,,2021-11-07 15:57:35.957290,"[(b'd\x00g\x01d\x01\x19\x00F\x00d\x02S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n [2][1]\n']" +11,AttributeError,module 'numpy' has no attribute 'hi',0,,2021-11-07 15:57:36.140927,"[(b'e\x00j\x01F\x00d\x00S\x00', 1), (b'|\x00d\x01k\x02r\x18d\x02d\x00l\x00m\x01}\x01\x01\x00|\x01S\x00|\x00d\x03k\x02r0d\x04d\x05l\x01m\x02}\x02\x01\x00|\x02S\x00t\x03d\x06\xa0\x04t\x05|\x00\xa1\x02\x83\x01\x82\x01d\x00S\x00', 219)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n np.hi\n', ' File ""/usr/local/lib/python3.8/site-packages/numpy/__init__.py"", line 219, in __getattr__\n raise AttributeError(""module {!r} has no attribute ""\n']" +12,ValueError,invalid literal for int() with base 10: 'HI',2,no,2021-11-07 15:57:36.331202,"[(b'e\x00d\x00\x83\x01F\x00d\x01S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n int(""HI"")\n']" +13,ZeroDivisionError,division by zero,3,asdf,2021-11-07 15:57:36.507918,"[(b'e\x00\x83\x00F\x00d\x00S\x00', 4), (b'd\x01d\x02\x1b\x00\x01\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 4, in \n f()\n', ' File """", line 2, in f\n 3 / 0\n']" +14,ZeroDivisionError,division by zero,3,adsfasdfasdfads,2021-11-07 15:57:36.689353,"[(b'e\x00\x83\x00F\x00d\x00S\x00', 1), (b'd\x01d\x02\x1b\x00\x01\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n f()\n', ' File """", line 2, in f\n 3 / 0\n']" From b0342896986de9d1ef2df2bfa46ab1711d759abf Mon Sep 17 00:00:00 2001 From: Divi Schmidt Date: Sun, 7 Nov 2021 15:37:09 -0800 Subject: [PATCH 3/4] modified trace summary to be more printable --- d8error.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d8error.py b/d8error.py index c6059d9..7063e80 100644 --- a/d8error.py +++ b/d8error.py @@ -35,7 +35,7 @@ def __init__(self, etype, value, tb, tb_offset=None): self.print = prewrittenMessge # this generates a semi-readable summary of the traceback, which includes some information about the python code that caused the error - summary = traceback.extract_tb(tb).format() + summary = traceback.format_exc().splitlines() # iterate through traceback object to extract linenumber and bytecode of the first two frames curr_tb = tb.tb_next # skip the first frame which is the jupyter notebook frame From 9203e5e37544393c572ed2c78fe0869ee9a26930 Mon Sep 17 00:00:00 2001 From: Divi Schmidt Date: Sun, 14 Nov 2021 22:22:11 -0800 Subject: [PATCH 4/4] added code information to csv logging --- d8error.py | 16 +++++++++++----- errorLog.csv | 26 ++++++++++++-------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/d8error.py b/d8error.py index 7063e80..7087d0f 100644 --- a/d8error.py +++ b/d8error.py @@ -39,9 +39,12 @@ def __init__(self, etype, value, tb, tb_offset=None): # iterate through traceback object to extract linenumber and bytecode of the first two frames curr_tb = tb.tb_next # skip the first frame which is the jupyter notebook frame - bytecodesToLinenos = [] - while curr_tb and len(bytecodesToLinenos) < 2: - bytecodesToLinenos.append((curr_tb.tb_frame.f_code.co_code, curr_tb.tb_lineno)) + + # get code from jupyter notebook + codeToLinenos = [] + while curr_tb and len(codeToLinenos) < 2: + code = self.parseTraceback(curr_tb) + codeToLinenos.append((code, curr_tb.tb_lineno)) curr_tb = curr_tb.tb_next @@ -54,7 +57,7 @@ def __init__(self, etype, value, tb, tb_offset=None): Announce.eindex = self.eindex + 1 with open('errorLog.csv', mode, newline='') as f: - fieldnames = ['index', 'errorType', 'errorMSG', 'feedbackRating', 'feedbackMSG', 'time', 'bytecodesToLinenos', 'traceSummary'] + fieldnames = ['index', 'errorType', 'errorMSG', 'feedbackRating', 'feedbackMSG', 'time', 'codeToLinenos', 'traceSummary'] writer = csv.DictWriter(f, fieldnames=fieldnames) writer.writerow({"index": self.eindex, "errorType": self.errorname, @@ -62,9 +65,12 @@ def __init__(self, etype, value, tb, tb_offset=None): "feedbackRating": self.feedbackRating, "feedbackMSG": self.feedbackMSG, "time": str(datetime.datetime.now()), - "bytecodesToLinenos": bytecodesToLinenos, + "codeToLinenos": codeToLinenos, "traceSummary":summary}) + def parseTraceback(self, tb): + return traceback.extract_tb(tb)[0].line + def tips(self): etype = self.etype value = self.value diff --git a/errorLog.csv b/errorLog.csv index 6ca211e..90e5dc1 100644 --- a/errorLog.csv +++ b/errorLog.csv @@ -1,14 +1,12 @@ -1,TypeError,'int' object is not callable,0,,2021-11-07 15:55:34.668983,"[(b'd\x00d\x01\x83\x01F\x00d\x02S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n 3(2)\n']" -2,TypeError,'int' object is not callable,4,no,2021-11-07 15:55:45.702924,"[(b'd\x00d\x01\x83\x01F\x00d\x02S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n 3(2)\n']" -3,AttributeError,'NoneType' object has no attribute 'hello',5,no,2021-11-07 15:56:20.834872,"[(b'e\x00j\x01F\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 2, in \n a.hello\n']" -4,AttributeError,'NoneType' object has no attribute 'hello',4,yes,2021-11-07 15:56:27.532666,"[(b'e\x00j\x01F\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 2, in \n a.hello\n']" -5,TypeError,'int' object is not callable,0,,2021-11-07 15:57:31.542810,"[(b'd\x00d\x01\x83\x01F\x00d\x02S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n 3(2)\n']" -6,AttributeError,'NoneType' object has no attribute 'hello',0,,2021-11-07 15:57:34.956975,"[(b'e\x00j\x01F\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 2, in \n a.hello\n']" -7,NameError,name 'data8' is not defined,0,,2021-11-07 15:57:35.415077,"[(b'e\x00F\x00d\x00S\x00', 15)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 15, in \n data8\n']" -8,SyntaxError,"invalid syntax (, line 1)",0,,2021-11-07 15:57:35.598874,"[(b't\x00|\x01|\x02|\x03|\x00j\x01t\x02B\x00d\x01\x83\x05S\x00', 101)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3116, in run_cell_async\n code_ast = compiler.ast_parse(cell, filename=cell_name)\n', ' File ""/usr/local/lib/python3.8/site-packages/IPython/core/compilerop.py"", line 101, in ast_parse\n return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)\n']" -9,AttributeError,module 'numpy' has no attribute 'aragne',0,,2021-11-07 15:57:35.775996,"[(b'e\x00\xa0\x01d\x00\xa1\x01F\x00d\x01S\x00', 1), (b'|\x00d\x01k\x02r\x18d\x02d\x00l\x00m\x01}\x01\x01\x00|\x01S\x00|\x00d\x03k\x02r0d\x04d\x05l\x01m\x02}\x02\x01\x00|\x02S\x00t\x03d\x06\xa0\x04t\x05|\x00\xa1\x02\x83\x01\x82\x01d\x00S\x00', 219)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n np.aragne(\'HI\')\n', ' File ""/usr/local/lib/python3.8/site-packages/numpy/__init__.py"", line 219, in __getattr__\n raise AttributeError(""module {!r} has no attribute ""\n']" -10,IndexError,list index out of range,0,,2021-11-07 15:57:35.957290,"[(b'd\x00g\x01d\x01\x19\x00F\x00d\x02S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n [2][1]\n']" -11,AttributeError,module 'numpy' has no attribute 'hi',0,,2021-11-07 15:57:36.140927,"[(b'e\x00j\x01F\x00d\x00S\x00', 1), (b'|\x00d\x01k\x02r\x18d\x02d\x00l\x00m\x01}\x01\x01\x00|\x01S\x00|\x00d\x03k\x02r0d\x04d\x05l\x01m\x02}\x02\x01\x00|\x02S\x00t\x03d\x06\xa0\x04t\x05|\x00\xa1\x02\x83\x01\x82\x01d\x00S\x00', 219)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n np.hi\n', ' File ""/usr/local/lib/python3.8/site-packages/numpy/__init__.py"", line 219, in __getattr__\n raise AttributeError(""module {!r} has no attribute ""\n']" -12,ValueError,invalid literal for int() with base 10: 'HI',2,no,2021-11-07 15:57:36.331202,"[(b'e\x00d\x00\x83\x01F\x00d\x01S\x00', 1)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n int(""HI"")\n']" -13,ZeroDivisionError,division by zero,3,asdf,2021-11-07 15:57:36.507918,"[(b'e\x00\x83\x00F\x00d\x00S\x00', 4), (b'd\x01d\x02\x1b\x00\x01\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 4, in \n f()\n', ' File """", line 2, in f\n 3 / 0\n']" -14,ZeroDivisionError,division by zero,3,adsfasdfasdfads,2021-11-07 15:57:36.689353,"[(b'e\x00\x83\x00F\x00d\x00S\x00', 1), (b'd\x01d\x02\x1b\x00\x01\x00d\x00S\x00', 2)]","[' File ""/usr/local/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3417, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n', ' File """", line 1, in \n f()\n', ' File """", line 2, in f\n 3 / 0\n']" +21,TypeError,'int' object is not callable,0,,2021-11-14 22:16:02.929285,"[('3(2)', 1)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/305253956.py"", line 1, in ', ' 3(2)', ""TypeError: 'int' object is not callable""]" +22,AttributeError,'NoneType' object has no attribute 'hello',0,,2021-11-14 22:16:03.122267,"[('a.hello', 2)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/2399003099.py"", line 2, in ', ' a.hello', ""AttributeError: 'NoneType' object has no attribute 'hello'""]" +23,NameError,name 'data8' is not defined,0,,2021-11-14 22:16:03.286388,"[('data8', 15)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/4159590661.py"", line 15, in ', ' data8', ""NameError: name 'data8' is not defined""]" +24,SyntaxError,"invalid syntax (1866965863.py, line 1)",0,,2021-11-14 22:16:03.453913,"[('return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)', 101)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3143, in run_cell_async', ' code_ast = compiler.ast_parse(cell, filename=cell_name)', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/compilerop.py"", line 101, in ast_parse', ' return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/1866965863.py"", line 1', ' 2a', ' ^', 'SyntaxError: invalid syntax']" +25,AttributeError,module 'numpy' has no attribute 'aragne',0,,2021-11-14 22:16:03.602083,"[(""np.aragne('HI')"", 1), ('raise AttributeError(""module {!r} has no attribute ""', 313)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/1147446779.py"", line 1, in ', "" np.aragne('HI')"", ' File ""/Users/divi/dsep/lib/python3.8/site-packages/numpy/__init__.py"", line 313, in __getattr__', ' raise AttributeError(""module {!r} has no attribute ""', ""AttributeError: module 'numpy' has no attribute 'aragne'""]" +26,IndexError,list index out of range,0,,2021-11-14 22:16:03.764988,"[('[2][1]', 1)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/1686336973.py"", line 1, in ', ' [2][1]', 'IndexError: list index out of range']" +27,AttributeError,module 'numpy' has no attribute 'hi',0,,2021-11-14 22:16:03.917816,"[('np.hi', 1), ('raise AttributeError(""module {!r} has no attribute ""', 313)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/1570163000.py"", line 1, in ', ' np.hi', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/numpy/__init__.py"", line 313, in __getattr__', ' raise AttributeError(""module {!r} has no attribute ""', ""AttributeError: module 'numpy' has no attribute 'hi'""]" +28,NameError,name 'Table' is not defined,0,,2021-11-14 22:16:04.064357,"[('Table()', 1)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/4234517321.py"", line 1, in ', ' Table()', ""NameError: name 'Table' is not defined""]" +29,ValueError,invalid literal for int() with base 10: 'HI',0,,2021-11-14 22:16:04.213243,"[('int(""HI"")', 1)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/532684827.py"", line 1, in ', ' int(""HI"")', ""ValueError: invalid literal for int() with base 10: 'HI'""]" +30,ZeroDivisionError,division by zero,0,,2021-11-14 22:16:04.381553,"[('f()', 4), ('1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 3 / 0', 2)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/3185432250.py"", line 4, in ', ' f()', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/3185432250.py"", line 2, in f', ' 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 3 / 0', 'ZeroDivisionError: division by zero']" +31,ZeroDivisionError,division by zero,0,,2021-11-14 22:16:04.571324,"[('g()', 2), ('g = lambda:f()', 1)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/1199893282.py"", line 2, in ', ' g()', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/1199893282.py"", line 1, in ', ' g = lambda:f()', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/3185432250.py"", line 2, in f', ' 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 3 / 0', 'ZeroDivisionError: division by zero']" +32,TypeError,'str' object cannot be interpreted as an integer,0,,2021-11-14 22:16:05.154673,"[('np.zeros((""23""))', 3)]","['Traceback (most recent call last):', ' File ""/Users/divi/dsep/lib/python3.8/site-packages/IPython/core/interactiveshell.py"", line 3444, in run_code', ' exec(code_obj, self.user_global_ns, self.user_ns)', ' File ""/var/folders/rj/c25q4n3534g4l32d2j4ml7g00000gn/T/ipykernel_64930/3299487035.py"", line 3, in ', ' np.zeros((""23""))', ""TypeError: 'str' object cannot be interpreted as an integer""]"