fastkml
fastkml copied to clipboard
Import error Django 2.2.5
Hi there. With Python 3.7.6, Django 2.2.5, fastkml 0.11, I have an app that attempts to import fastkml in the view.py and this is raising an error. Oddly, the error does not occur on import into the Python console. For example:
Python 3.7.6 (default, Dec 30 2019, 19:38:26) [Clang 11.0.0 (clang-1100.0.33.16)] on darwin Django 2.2.5
import fastkml
No problem. But when I attempt to call it in my views.py I get error. The traceback looks like this:
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
raise _exception[1]
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/core/management/init.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/contrib/admin/apps.py", line 24, in ready
self.module.autodiscover()
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/contrib/admin/init.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "/Users/dreed/Documents/pycharm/paleocore/venv/lib/python3.7/site-packages/django/utils/module_loading.py", line 47, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
looks like the last commit on fastkml/init.py might be the source of the problem. Removing the changes from that commit, i.e. the call to pkg_resources on line 28 resolves the issue. Not sure why importing pkg_resources is creating problems.