Python crashes when respawning after source code changed

When running any python installation via pycharm everything works fine until I change the source code and python tries to restart the service. This happens ONLY when running via IntelliJ. When running with the exact command via the command line then it respawns without issues.

Here is the log:

[27/Jul/2020:19:04:00] ENGINE Restarting because /home/quintin/myceliapp/app/backend/src/ changed.
[27/Jul/2020:19:04:00] ENGINE Stopped thread 'Autoreloader'.
[27/Jul/2020:19:04:00] ENGINE Bus STOPPING
[27/Jul/2020:19:04:00] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('', 8081)) shut down
[27/Jul/2020:19:04:00] ENGINE Bus STOPPED
[27/Jul/2020:19:04:00] ENGINE Bus EXITING
[27/Jul/2020:19:04:00] ENGINE Bus EXITED
[27/Jul/2020:19:04:00] ENGINE Waiting for child threads to terminate...
[27/Jul/2020:19:04:00] ENGINE Re-spawning /home/quintin/.pycharm/backend/bin/python -s /home/quintin/.local/share/JetBrains/IdeaIC2020.1/python-ce/helpers/pydev/ --cmd-line --multiproc --qt-support=auto --client --port 42249 --file /home/quintin/myceliapp/app/backend/src/ 8081
Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "/opt/python/active/lib/python3.8/", line 580, in <module>
File "/opt/python/active/lib/python3.8/", line 567, in main
known_paths = addsitepackages(known_paths)
File "/opt/python/active/lib/python3.8/", line 350, in addsitepackages
addsitedir(sitedir, known_paths)
File "/opt/python/active/lib/python3.8/", line 208, in addsitedir
addpackage(sitedir, name, known_paths)
File "/opt/python/active/lib/python3.8/", line 169, in addpackage
File "<string>", line 1, in <module>
File "/opt/python/active/lib/python3.8/importlib/", line 2, in <module>
from . import abc
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 971, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 914, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1342, in find_spec
File "<frozen importlib._bootstrap_external>", line 1314, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1439, in find_spec
File "<frozen importlib._bootstrap_external>", line 87, in _path_stat

Comment actions Permalink

It appears this only happens when debugging. During debugging this is my sys.path:

['/home/quintin/myceliapp/app/backend/src', '/home/quintin/.local/share/JetBrains/IdeaIC2020.1/python-ce/helpers/pydev', '/home/quintin/myceliapp/app/backend/src', '/home/quintin/.local/share/JetBrains/IdeaIC2020.1/python-ce/helpers/third_party/thriftpy', '/home/quintin/.local/share/JetBrains/IdeaIC2020.1/python-ce/helpers/pydev', '/home/quintin/.cache/JetBrains/IdeaIC2020.1/cythonExtensions', '/home/quintin/myceliapp/app/backend', '/opt/python/active/lib/', '/opt/python/active/lib/python3.8', '/opt/python/active/lib/python3.8/lib-dynload', '/home/quintin/.pycharm/backend/lib/python3.8/site-packages', '/home/quintin/.local/lib/python3.8/site-packages', '/opt/python/active/lib/python3.8/site-packages']

Comment actions Permalink

Hi, could you please provide more informaation about the issue, such as:

- What type of project are you working on? 

- Is it possible to reproduce with minimal code and provide the example? 


Please sign in to leave a comment.