pipenv
pipenv copied to clipboard
Terminal unresponsive when using ipdb and Django
Issue description
When running a Django runserver process, and invoking a import ipdb; ipdb.set_trace(), if you modify a file and the process restarts, your keyboard inputs will not longer be sent through to the new process.
You will be left in a state where your commands will be displayed to the screen however the only course of action will be to kill the process from a different terminal window.
I have tested with pdb and it does not suffer the same behaviour. So very likely limited to ipdb/ipython however given how popular these tools are, and your familiarity with pipenv and it's interaction with other tools in the ecosystem I figure it wouldn't hurt to drop a message here.
Expected result
Keyboard commands would continue to be send to the running process, allowing one to execute normal keyboard functions.
Actual result
ashchristopher@Ashs-Shopify-MacBook-Pro:~/src/github.com/Shopify/django-shopify-app/demo$ pipenv run ./manage.py runserver
Loading .env environment variables…
Performing system checks...
System check identified no issues (0 silenced).
December 24, 2018 - 18:21:53
Django version 2.1.4, using settings 'demo.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[24/Dec/2018 18:21:58] "GET /login/ HTTP/1.1" 200 2938
[24/Dec/2018 18:22:00] "POST /login/ HTTP/1.1" 302 0
> /Users/ashchristopher/src/github.com/Shopify/django-shopify-app/shopify_app/views/test.py(32)get()
31 import ipdb; ipdb.set_trace()
---> 32 # some test code
33
ipdb> Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/Users/ashchristopher/.virtualenvs/demo-ZtWU8rHS/lib/python3.7/site-packages/IPython/core/history.py", line 780, in writeout_cache
self._writeout_input_cache(conn)
File "/Users/ashchristopher/.virtualenvs/demo-ZtWU8rHS/lib/python3.7/site-packages/IPython/core/history.py", line 764, in _writeout_input_cache
(self.session_number,)+line)
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 123145547837440 and this is thread id 4613088704.
Performing system checks...
System check identified no issues (0 silenced).
December 24, 2018 - 18:22:07
Django version 2.1.4, using settings 'demo.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
^C^C^C^C^Z^Z^Z^Z^C^C^C^C
As you can see, the keyboard commands are sent to the display, but not to the underlying process. This is using a vanilla version of bash.
Steps to replicate
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
- Create a demo Django application, and add a
import pdb; pdb.set_trace()in a view. - Run the Django project
pipenv run ./manage.py runserver. - Navigate to the associated URL in a browser.
- When the program is interrupted, and you are presented with the
ipdbconsole, modify a file and save it. - Try to
control-Cout of the process.
$ pipenv --support
Pipenv version: '2018.11.26'
Pipenv location: '/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv'
Python location: '/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7'
Python installations found:
3.6.5:/Users/ashchristopher/.pyenv/versions/3.6.5/bin/python33.6.5:/Users/ashchristopher/.pyenv/versions/3.6.5/bin/python3.6m2.7.10:/usr/bin/python2.7.10:/usr/bin/pythonw2.7.10:/usr/bin/python2.7
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.7.1',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '18.0.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT '
'2018; root:xnu-4903.201.2~1/RELEASE_X86_64',
'python_full_version': '3.7.1',
'python_version': '3.7',
'sys_platform': 'darwin'}
System environment variables:
PATHTERM_PROGRAMTERMSHELLCLICOLORTMPDIRApple_PubSub_Socket_RenderTERM_PROGRAM_VERSIONDEV_AUTO_ENV_FEATURESTERM_SESSION_IDLC_ALLUSERMACOS_SW_VERSIONSSH_AUTH_SOCKUSING_DEVWORKON_HOMELSCOLORSVIRTUALENVWRAPPER_PYTHON_PWDLANGCLOUDSDK_PYTHONXPC_FLAGSXPC_SERVICE_NAMESHLVLPYENV_SHELLHOMELANGUAGELOGNAMESECURITYSESSIONID__CF_USER_TEXT_ENCODINGPIP_DISABLE_PIP_VERSION_CHECKPYTHONDONTWRITEBYTECODEPIP_SHIMS_BASE_MODULEPIP_PYTHON_PATHPYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH:/usr/local/Cellar/pipenv/2018.11.26/libexec/tools:/opt/dev/bin/user:/Users/ashchristopher/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbinSHELL:/usr/local/bin/bashLANG:en_CA.UTF-8PWD:/Users/ashchristopher/src/github.com/Shopify/django-shopify-app/demo
Contents of Pipfile ('/Users/ashchristopher/src/github.com/Shopify/django-shopify-app/demo/Pipfile'):
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
[requires]
python_version = "3.7"
@ashchristopher do you still ask for support with this issue?