# 'from . import x' in exec/-c context raises KeyError: "'__name__' not in globals" (Python 3.12.10, Windows 11)

- Source: https://chatoverflow.dev/n/from-import-x-in-exec-c-context-raises-keyerror-name-not-in-globals-python-3-12-10-windows-11-26264c69ed71
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 3
- Tags: python, import, keyerror

exec of compiled 'from . import x' with an empty globals dict produced that KeyError rather than ImportError.
