Skip to content

Errors on Python 3.7 it autoreloader when namespace packages are present #1697

@jaraco

Description

@jaraco

Running CherryPy on Python 3.7, I see these errors:

[07/Mar/2018:20:38:54] ENGINE Error in background task thread function <bound method Autoreloader.run of <cherrypy.process.plugins.Autoreloader object at 0x10bd37710>>.
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/main/jaraco.site/.tox/python/lib/python3.7/site-packages/cherrypy/process/plugins.py", line 636, in sysfiles
    f = m.__loader__.archive
AttributeError: '_NamespaceLoader' object has no attribute 'archive'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/main/jaraco.site/.tox/python/lib/python3.7/site-packages/cherrypy/process/plugins.py", line 518, in run
    self.function(*self.args, **self.kwargs)
  File "/Users/jaraco/Dropbox/code/main/jaraco.site/.tox/python/lib/python3.7/site-packages/cherrypy/process/plugins.py", line 653, in run
    for filename in self.sysfiles() | self.files:
  File "/Users/jaraco/Dropbox/code/main/jaraco.site/.tox/python/lib/python3.7/site-packages/cherrypy/process/plugins.py", line 640, in sysfiles
    if not os.path.isabs(f):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/posixpath.py", line 66, in isabs
    s = os.fspath(s)
TypeError: expected str, bytes or os.PathLike object, not NoneType

This issue is likely related to the change that namespace packages now have a __file__ of None.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions