This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ronaldoussoren
Recipients ronaldoussoren
Date 2015-05-14.11:58:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1431604720.34.0.497693265378.issue24192@psf.upfronthosting.co.za>
In-reply-to
Content
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

os.mkdir('path1')
os.mkdir('path1/package')
with open('path1/package/mod.py', 'w') as fp:
    fp.write('print(42)\n')

import site
site.addsitedir('path1')
import package.mod
History
Date User Action Args
2015-05-14 11:58:40ronaldoussorensetrecipients: + ronaldoussoren
2015-05-14 11:58:40ronaldoussorensetmessageid: <1431604720.34.0.497693265378.issue24192@psf.upfronthosting.co.za>
2015-05-14 11:58:40ronaldoussorenlinkissue24192 messages
2015-05-14 11:58:39ronaldoussorencreate