cannot import name SortedDict

255 views
Skip to first unread message

Etienne Robillard

unread,
Sep 20, 2016, 6:30:01 AM9/20/16
to django...@googlegroups.com
Hi,

I'm trying to run Satchmo on Django 1.10. I have removed from the
app_plugins.templatetags.app_plugins

module the deprecated import of SortedDict. Could this import statement
be cached by the Django cache backend ?

I have replaced the only occurence of SortedDict by
collections.OrderedDict in app_plugins.library.py.

Is there something obvious I'm missing ?


Thanks,

Etienne



Environment:


Request Method: GET
Request URL: http://localhost:9000/

Django Version: 1.10
Python Version: 2.7.9
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.sessions',
'django.contrib.sitemaps',
'satchmo_store.shop',
'satchmo_store',
'sorl.thumbnail',
'keyedcache',
'livesettings',
'l10n',
'satchmo_store.contact',
'tax',
'tax.modules.no',
'tax.modules.area',
'tax.modules.percent',
'shipping',
'product',
'payment',
'payment.modules.dummy',
'satchmo_ext.satchmo_toolbar',
'satchmo_utils',
'app_plugins')
Installed Middleware:
['django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware']



Traceback:

File "/home/erob/ncvs/django/django/core/handlers/exception.py" in inner
39. response = get_response(request)

File "/home/erob/ncvs/django/django/core/handlers/base.py" in _get_response
187. response =
self.process_exception_by_middleware(e, request)

File "/home/erob/ncvs/django/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request,
*callback_args, **callback_kwargs)

File
"/home/erob/src/livestore/trunk/lib/satchmo_store/shop/views/home.py" in
home
42. return render(request, template, ctx)

File "/home/erob/ncvs/django/django/shortcuts.py" in render
30. content = loader.render_to_string(template_name, context,
request, using=using)

File "/home/erob/ncvs/django/django/template/loader.py" in render_to_string
67. template = get_template(template_name, using=using)

File "/home/erob/ncvs/django/django/template/loader.py" in get_template
18. engines = _engine_list(using)

File "/home/erob/ncvs/django/django/template/loader.py" in _engine_list
72. return engines.all() if using is None else [engines[using]]

File "/home/erob/ncvs/django/django/template/utils.py" in all
89. return [self[alias] for alias in self]

File "/home/erob/ncvs/django/django/template/utils.py" in __getitem__
80. engine = engine_cls(params)

File "/home/erob/ncvs/django/django/template/backends/django.py" in __init__
30. options['libraries'] =
self.get_templatetag_libraries(libraries)

File "/home/erob/ncvs/django/django/template/backends/django.py" in
get_templatetag_libraries
48. libraries = get_installed_libraries()

File "/home/erob/ncvs/django/django/template/backends/django.py" in
get_installed_libraries
113. for name in get_package_libraries(pkg):

File "/home/erob/ncvs/django/django/template/backends/django.py" in
get_package_libraries
130. "trying to load '%s': %s" % (entry[1], e)

Exception Type: InvalidTemplateLibrary at /
Exception Value: Invalid template library specified. ImportError raised
when trying to load 'app_plugins.templatetags.app_plugins': cannot
import name SortedDict

Alessandro Madruga Correia

unread,
Sep 20, 2016, 10:39:26 AM9/20/16
to django...@googlegroups.com
On Tue, Sep 20, 2016 at 7:29 AM, Etienne Robillard <tka...@yandex.com> wrote:
Hi,

I'm trying to run Satchmo on Django 1.10. I have removed from the app_plugins.templatetags.app_plugins

module the deprecated import of SortedDict. Could this import statement be cached by the  Django cache backend ?

I have replaced the only occurence of SortedDict by collections.OrderedDict in app_plugins.library.py.

Is there something obvious I'm missing ?


I don't know this lib, but did you can try this https://github.com/aljosa/django-tinymce/issues/114


--
  ,= ,-_-. =.   [<o>] Alessandro Madruga Correia
 ((_/)o o(\_))  [http://counter.li.org]       Debian User# 342751 
   `-'(. .)`-'    "O fanatismo é a única forma de força de vontade 
       \_/        acessível aos fracos." (Friedrich Nietzsche)

Etienne Robillard

unread,
Sep 20, 2016, 11:22:16 AM9/20/16
to django...@googlegroups.com

Hi Alessandro,

I have replaced the only occurrence of SortedDict with collections.OrderedDict in app_plugins, but the issue persist.

Is it possible that the templatetags module is being cached somehow by Django ?

Thanks,

Etienne



Le 2016-09-20 à 08:27, Alessandro Madruga Correia a écrit :


I don't know this lib, but did you can try this https://github.com/aljosa/django-tinymce/issues/114


--
  ,= ,-_-. =.   [<o>] Alessandro Madruga Correia
 ((_/)o o(\_))  [http://counter.li.org]       Debian User# 342751 
   `-'(. .)`-'    "O fanatismo é a única forma de força de vontade 
       \_/        acessível aos fracos." (Friedrich Nietzsche)


Michal Petrucha

unread,
Sep 20, 2016, 11:26:43 AM9/20/16
to django...@googlegroups.com
On Tue, Sep 20, 2016 at 11:21:20AM -0400, Etienne Robillard wrote:
> Hi Alessandro,
>
> I have replaced the only occurrence of SortedDict with
> collections.OrderedDict in app_plugins, but the issue persist.
>
> Is it possible that the templatetags module is being cached somehow by
> Django ?
>
> Thanks,
>
> Etienne

No, Django caching never applies to Python code. However, as with any
code change, you need to make sure to restart the Python process
(i.e., if you're running under gunicorn or uwsgi, restart those, if
you're using runserver, you might have to try restarting it – most of
the time, runserver tries to reload itself automatically, but there
are pathological cases where it doesn't work).

If that doesn't help, try checking if there are any stale leftover
.pyc files, and try removing those.

Good luck,

Michal
signature.asc

Etienne Robillard

unread,
Sep 20, 2016, 11:34:33 AM9/20/16
to django...@googlegroups.com


Le 2016-09-20 à 11:25, Michal Petrucha a écrit :.
> If that doesn't help, try checking if there are any stale leftover
> .pyc files, and try removing those.
>
> Good luck,
>
> Michal
>
That did the trick... There was a old .pyc file in my Django source tree
from a old branch...

Thanks,

Etienne
Reply all
Reply to author
Forward
0 new messages