[New-bugs-announce] [issue24192] unexpected system error with pep420 style namespace packages

Ronald Oussoren report at bugs.python.org
Thu May 14 13:58:40 CEST 2015

New submission from Ronald Oussoren:

The script below creates a basic PEP 420 style package with a single module in it ('package.sub') and tries to import that module

With 3.5 the script runs without problems and prints 42 (as expected). 

With a 3.5 (fresh checkout as of 2015-05-14) I get an SystemError:

$ python3.5 demo.py
Traceback (most recent call last):
  File "demo.py", line 10, in <module>
    import package.mod
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load
  File "<frozen importlib._bootstrap>", line 947, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 575, in module_from_spec
  File "<frozen importlib._bootstrap>", line 519, in _init_module_attrs
SystemError: Parent module '' not loaded, cannot perform relative import

import os

with open('path1/package/mod.py', 'w') as fp:

import site
import package.mod

components: Interpreter Core
messages: 243181
nosy: ronaldoussoren
priority: normal
severity: normal
status: open
title: unexpected system error with pep420 style namespace packages
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list