Message243181
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 |
|
Date |
User |
Action |
Args |
2015-05-14 11:58:40 | ronaldoussoren | set | recipients:
+ ronaldoussoren |
2015-05-14 11:58:40 | ronaldoussoren | set | messageid: <1431604720.34.0.497693265378.issue24192@psf.upfronthosting.co.za> |
2015-05-14 11:58:40 | ronaldoussoren | link | issue24192 messages |
2015-05-14 11:58:39 | ronaldoussoren | create | |
|