{"record":{"id":"828c3b85b09879dd","repo":"rohitg00/ai-engineering-from-scratch","slug":"denied-module-s","errorCode":null,"errorMessage":"denied module: %s","messagePattern":"denied module: (.+?)","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/72-code-exec-metric/code/main.py","lineNumber":78,"sourceCode":"            \"per_assertion\": list(self.per_assertion),\n        }\n\n\nRUNNER_TEMPLATE = r\"\"\"\nimport json, sys, traceback\nimport builtins as _builtins\n\n_DENIED_MODULES = {\n    'subprocess', 'socket', 'shutil', 'requests', 'urllib',\n    'urllib.request', 'urllib.error', 'urllib.parse', 'ctypes',\n    'http.client', 'asyncio.subprocess',\n}\n\n_real_import = _builtins.__import__\ndef _guarded_import(name, *args, **kwargs):\n    base = name.split('.')[0]\n    if name in _DENIED_MODULES or base in _DENIED_MODULES:\n        raise ImportError(\"denied module: %s\" % name)\n    return _real_import(name, *args, **kwargs)\n_builtins.__import__ = _guarded_import\n\nimport os as _os\ndef _denied_system(_cmd):\n    raise OSError(\"os.system denied\")\n_os.system = _denied_system\n\nCODE = __PLACEHOLDER_CODE__\nASSERTIONS = __PLACEHOLDER_ASSERTIONS__\n\nns = {}\nstatus = {\"exit_code\": \"pass\", \"results\": [], \"detail\": \"\"}\ntry:\n    compiled = compile(CODE, \"<candidate>\", \"exec\")\nexcept SyntaxError as exc:\n    status[\"exit_code\"] = \"syntax_error\"\n    status[\"detail\"] = \"SyntaxError: %s\" % exc","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/72-code-exec-metric/code/main.py#L60-L96","documentation":"Error \"denied module: %s\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/72-code-exec-metric/code/main.py:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}