Skip to content

_pickle.PicklingError: Cannot pickle ResolverMatch. #133

@suncowiam

Description

@suncowiam

Hi all,
Not sure if this is an issue with widget-tweaks. I'm trying to run the demo of django-modal-form and am running into the following issue:

Internal Server Error: /modal/signup/
Traceback (most recent call last):
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\core\handlers\base.py", line 220, in _get_response
    response = response.render()
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\response.py", line 111, in render
    self.content = self.rendered_content
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\response.py", line 89, in rendered_content
    return template.render(context, self._request)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\backends\django.py", line 61, in render
    return self.template.render(context)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\base.py", line 175, in render
    return self._render(context)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\test\utils.py", line 112, in instrumented_test_render
    return self.nodelist.render(context)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\base.py", line 1005, in render
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\base.py", line 1005, in <listcomp>
    return SafeString("".join([node.render_annotated(context) for node in self]))
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\defaulttags.py", line 238, in render
    nodelist.append(node.render_annotated(context))
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\template\base.py", line 966, in render_annotated
    return self.render(context)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\widget_tweaks\templatetags\widget_tweaks.py", line 194, in render
    bounded_field = set_attr(bounded_field, '%s:%s' % (k,v.resolve(context)))
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\widget_tweaks\templatetags\widget_tweaks.py", line 15, in wrapped
    return fn(field, attr)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\widget_tweaks\templatetags\widget_tweaks.py", line 56, in set_attr
    return _process_field_attributes(field, attr, process)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\widget_tweaks\templatetags\widget_tweaks.py", line 31, in _process_field_attributes
    field = copy.deepcopy(field)
  File "C:\Program Files\Python39\lib\copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "C:\Program Files\Python39\lib\copy.py", line 270, in _reconstruct
    state = deepcopy(state, memo)
  File "C:\Program Files\Python39\lib\copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "C:\Program Files\Python39\lib\copy.py", line 230, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "C:\Program Files\Python39\lib\copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "C:\Program Files\Python39\lib\copy.py", line 270, in _reconstruct
    state = deepcopy(state, memo)
  File "C:\Program Files\Python39\lib\copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "C:\Program Files\Python39\lib\copy.py", line 230, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "C:\Program Files\Python39\lib\copy.py", line 153, in deepcopy
    y = copier(memo)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\http\request.py", line 98, in __deepcopy__
    setattr(obj, attr, copy.deepcopy(getattr(self, attr), memo))
  File "C:\Program Files\Python39\lib\copy.py", line 161, in deepcopy
    rv = reductor(4)
  File "C:\Users\sunco\AppData\Roaming\Python\Python39\site-packages\django\urls\resolvers.py", line 102, in __reduce_ex__
    raise PicklingError(f"Cannot pickle {self.__class__.__qualname__}.")
_pickle.PicklingError: Cannot pickle ResolverMatch.

Looked online for this but could not find anything. Any help would be appreciated. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions