importlib changes from py3.7 to py3.8
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Sep 19 20:03:21 EDT 2020
On 19/09/20 7:51 am, Eko palypse wrote:
> ValueError: source code string cannot contain null bytes
>
> Any idea what happened here?
> Seems I've missed that __init__.py's aren't allowed to be empty anymore.
> Adding a single # solved the issue.
I just tried importing a package with an empty __init__.py in
Python 3.8 and there was no problem:
% ls -l empty
total 0
-rw-r--r-- 1 greg staff 0 20 Sep 12:00 __init__.py
% python3
Python 3.8.2 (default, Mar 23 2020, 11:36:18)
[Clang 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import empty
>>>
It looks more like the file in question wasn't completely empty,
but had a null character in it for some reason. I expect that if
you re-saved it as truly empty it would work. If not, you should
probably report it as a bug.
--
Greg
More information about the Python-list
mailing list