kolofordjango / kolo

See everything happening in your running Django app. All without leaving VSCode
https://kolo.app
504 stars 14 forks source link

TypeError: unhashable type: 'types.SimpleNamespace' #94

Closed EssaAlshammri closed 2 weeks ago

EssaAlshammri commented 2 weeks ago

after updating kolo to 2.33.8

it used to be working fine before that version

Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 74, in execute
    super().execute(*args, **options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 111, in handle
    self.run(**options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 118, in run
    autoreload.run_with_reloader(self.inner_run, **options)
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 680, in run_with_reloader
    start_django(reloader, main_func, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 661, in start_django
    reloader.run(django_main_thread)
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 344, in run
    self.run_loop()
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 350, in run_loop
    next(ticker)
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 390, in tick
    for filepath, mtime in self.snapshot_files():
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 411, in snapshot_files
    for file in self.watched_files():
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 304, in watched_files
    yield from iter_all_python_module_files()
  File "/usr/local/lib/python3.8/site-packages/django/utils/autoreload.py", line 120, in iter_all_python_module_files
    return iter_modules_and_files(modules, frozenset(_error_files))
TypeError: unhashable type: 'types.SimpleNamespace'
EssaAlshammri commented 2 weeks ago

something to note

the first request goes well and kolo vs extension does capture it

the server is still up but the following requests fail

what I do now after each requests I comment and uncomment the middleware line everytime I want to use kolo

wilhelmklopp commented 2 weeks ago

👋 Thanks for the report – are you sure this issue stems from Kolo? Asking because I've not seen this error before and it doesn't immediately seem like kolo is the culprit.

is it possible another package was upgraded alongside kolo that could be causing this?

What was the last kolo version that worked for you?

wilhelmklopp commented 2 weeks ago

Had a quick chat with Claude about your stacktrace and it seems to suggest that from Python 3.9 onwards types.SimpleNamespace becomes hashable. So if upgrading python versions is an option for you, i'd recommend checking if this error still happens on on 3.9 or newer

EssaAlshammri commented 2 weeks ago

yeah sorry

I've just tried it with another project and it works like a charm

but the thing is it was working with this one before and I thought it was because of the update. the project hasn't changed at all and I've already tried down to 2.33.4 and still not working.

I'm pretty sure now it's my setup not kolo