Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reloader: RuntimeError in thread due to 'dict. size change' (+ workaround) #275

Closed
appultaart opened this issue Jan 29, 2012 · 1 comment

Comments

@appultaart
Copy link

(Disclaimer: (1)Just starting out with Bottle framework, in attempt to create simple, web-based access to local database, and (2) no professional Python coder.)

Issue: When I enable the auto-reloader with the "run(reloader=True)" command on my Ubuntu box (2.6.32-38, 64bit):

with Python 2.6: all works as expected
with Python 3.2.2: a RuntimeError appears, and the auto-reloader obviously does not start. Here's the error:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/me/programs/Python-3.2.2/lib/python3.2/threading.py", line 740, in _bootstrap_inner
self.run()
File "/home/me/python/bottle_webFramework/myScripts/bottle.py", line 2507, in run
for module in sys.modules.values():
RuntimeError: dictionary changed size during iteration

Error can be solved (and functional reloader obtained, as expected), by explicitly declaring as a list in lines 2507 and 2517, but this is probably a dirty workaround only (I'm not familiar with system level thread checks...):

@ 2507
--- for module in sys.modules.values():
+++ for module in list(sys.modules.values()):

@ 2517
--- for path, lmtime in files.items():
+++ for path, lmtime in list(files.items()):

Hope this helps,
thanks for a nice, simple webframework!

@defnull defnull closed this as completed in b2b4309 Feb 1, 2012
@defnull
Copy link
Member

defnull commented Feb 1, 2012

Thanks, should be fixed in master now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants