Python Console (Remote with Django) crashes due to errors
Answered
So, I have remote Python interpreter in Django project. When I rise some errors in console it throws me the error and shooting down the console.
p.s.
I have recently updated to the new version of PyCharm
_______
PyCharm 2021.3 (Professional Edition)
Build #PY-213.5744.248, built on November 30, 2021
Licensed to xxx
Runtime version: 11.0.13+7-b1751.19 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1536M
Cores: 4
sudo+ssh://roman@x.x.x.x:22/home/roman/x/venv/bin/python3 -u /home/roman/.pycharm_helpers/pydev/pydevconsole.py --mode=server
import sys; print('Python %s on %s' % (sys.version, sys.platform))
import django; print('Django %s' % django.get_version())
sys.path.extend(['/home/roman/x/x', '/home/roman/.pycharm_helpers/pycharm', '/home/roman/.pycharm_helpers/pydev'])
if 'setup' in dir(django): django.setup()
import django_manage_shell; django_manage_shell.run("/home/roman/x/x")
PyDev console: starting.
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Django 3.2.5
>>> some error
Traceback (most recent call last):
File "/usr/lib/python3.8/code.py", line 63, in runsource
code = self.compile(source, filename, symbol)
File "/usr/lib/python3.8/codeop.py", line 178, in __call__
return _maybe_compile(self.compiler, source, filename, symbol)
File "/usr/lib/python3.8/codeop.py", line 106, in _maybe_compile
raise err1
File "/usr/lib/python3.8/codeop.py", line 93, in _maybe_compile
code1 = compiler(source + "\n", filename, symbol)
File "/usr/lib/python3.8/codeop.py", line 143, in __call__
codeob = compile(source, filename, symbol, self.flags, 1)
File "<input>", line 1
some error
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roman/.pycharm_helpers/pydev/_pydev_bundle/pydev_code_executor.py", line 108, in add_exec
more, exception_occurred = self.do_add_exec(code_fragment)
File "/home/roman/.pycharm_helpers/pydev/pydevconsole.py", line 90, in do_add_exec
command.run()
File "/home/roman/.pycharm_helpers/pydev/_pydev_bundle/pydev_console_types.py", line 35, in run
self.more = self.interpreter.runsource(text, '<input>', symbol)
File "/usr/lib/python3.8/code.py", line 66, in runsource
self.showsyntaxerror(filename)
File "/usr/lib/python3.8/code.py", line 129, in showsyntaxerror
sys.excepthook(type, value, tb)
File "/home/roman/.pycharm_helpers/pydev/pydevconsole.py", line 112, in info
traceback.print_exception(type, value, tb)
NameError: name 'traceback' is not defined
Traceback (most recent call last):
File "/home/roman/.pycharm_helpers/pydev/pydevconsole.py", line 284, in process_exec_queue
interpreter.add_exec(code_fragment)
File "/home/roman/.pycharm_helpers/pydev/_pydev_bundle/pydev_code_executor.py", line 132, in add_exec
return more, exception_occurred
UnboundLocalError: local variable 'exception_occurred' referenced before assignment
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/roman/.pycharm_helpers/pydev/pydevconsole.py", line 511, in <module>
pydevconsole.start_server(port)
File "/home/roman/.pycharm_helpers/pydev/pydevconsole.py", line 407, in start_server
process_exec_queue(interpreter)
File "/home/roman/.pycharm_helpers/pydev/pydevconsole.py", line 292, in process_exec_queue
traceback.print_exception(type, value, tb, file=sys.__stderr__)
UnboundLocalError: local variable 'traceback' referenced before assignment
Process finished with exit code 1
Please sign in to leave a comment.
Hi, unfortunately it's not very clear what's happening. Could you please submit an issue to https://youtrack.jetbrains.com/issues/py with the following data:
1. Detailed steps to reproduce the issue
2. Screenshots or a screen recording demonstrating the issue
3. Logs from **Help | Collect Logs and Diagnostic Data** after reproducing the issue
Here it is: https://youtrack.jetbrains.com/issue/PY-51989