Error in Spyder console when printing - python

I have this problem with Spyder(in Windows 10). When I try to do anything on my spyder console (even something as simple as 1+1), I get the following error message in the internal console tab:
(Any help will be appreciated)
Traceback (most recent call last): <br> <br>
File "C:\Users\ JohnDoe \Anaconda2\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch<br><br>
Traceback (most recent call last):<br><br>
File "C:\Users\ JohnDoe \Anaconda2\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch<br><br>
handler(msg)<br><br>
File "C:\Users\JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 188, in _handle_execute_reply<br><br>
self.handle_exec_method(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 225, in handle_exec_method<br><br>
properties = ast.literal_eval(data['text/plain'])<br><br>
KeyError: 'text/plain'<br><br>
handler(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 188, in _handle_execute_reply<br><br>
self.handle_exec_method(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 222, in handle_exec_method<br><br>
view = ast.literal_eval(data['text/plain'])<br><br>
KeyError: 'text/plain'

The problem gets resolved when you install Spyder 3 like Carlos mentioned
This error was fixed in Spyder 3.0.2. Please update to that version.
However, it actually does not impacts my codes or run times. The only drawback is that you cannot test your codes out on the machines which shows this error.

Related

Problems with let otree devserver run

I have a Python Code to conduct an experiment. To ensure that the Code is working smoothly I wanted to run a trial round via 'otree devserver', but I always get an AttributeError message and I am stuck here. Can anyone help me out?
I have downloaded the Code from GitHub and downloaded all required packages. I am using macOS, otree-5.10.2 and django-4.1.7. Here is my full traceback / error message:
Traceback (most recent call last): File
"/Users/.otreevenv/bin/otree", line 8, in
sys.exit(execute_from_command_line()) File "/Users/.otreevenv/lib/python3.10/site-packages/otree/main.py", line
108, in execute_from_command_line
setup() File "/Users/.otreevenv/lib/python3.10/site-packages/otree/main.py", line
132, in setup
from otree import settings File "/Users/.otreevenv/lib/python3.10/site-packages/otree/settings.py",
line 50, in
OTREE_APPS = get_OTREE_APPS(settings.SESSION_CONFIGS) File "/Users/.otreevenv/lib/python3.10/site-packages/django/conf/__init__.py",
line 94, in __getattr__
val = getattr(_wrapped, name) File "/Users/.otreevenv/lib/python3.10/site-packages/django/conf/__init__.py",
line 270, in __getattr__
return getattr(self.default_settings, name) AttributeError: module 'django.conf.global_settings' has no attribute 'SESSION_CONFIGS'. Did
you mean: 'SESSION_ENGINE'?

Urequests micropython gets stuck

It gets stuck on the first urequests.get()
I have tried EVERYTHING, it prompts me this error
`Traceback (most recent call last):
File "<stdin>", line 26, in <module>
File "urequests.py", line 180, in get
File "urequests.py", line 76, in request
OSError: -1
`
Help please
Tried reinstalling the uf2, flash nuking it, importing manually urequests, NOTHING, i cant finish my prject without this.

Using language check module for python - "can't find Java" error

I'm planning to use the Language-check module for python 3 in my poem making code. I was just testing it with
import language_tool
lang_tool = language_tool.LanguageTool("en-US")
text = "A sentence with a error in the Hitchhiker’s Guide tot he Galaxy"
matches = lang_tool.check(text)
print(len(matches))
but it gave me this error.
Traceback (most recent call last):
File "/home/runner/.site-packages/language_tool/__init__.py", line 548, in get_server_cmd
cmd = cache["server_cmd"]
KeyError: 'server_cmd'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/runner/.site-packages/language_tool/__init__.py", line 559, in get_jar_info
java_path, jar_path = cache["jar_info"]
KeyError: 'jar_info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 10, in <module>
lang_tool = language_tool.LanguageTool("en-US")
File "/home/runner/.site-packages/language_tool/__init__.py", line 188, in __init__
self._start_server_on_free_port()
File "/home/runner/.site-packages/language_tool/__init__.py", line 323, in _start_server_on_free_port
cls._start_server()
File "/home/runner/.site-packages/language_tool/__init__.py", line 335, in _start_server
server_cmd = get_server_cmd(cls._port)
File "/home/runner/.site-packages/language_tool/__init__.py", line 550, in get_server_cmd
java_path, jar_path = get_jar_info()
File "/home/runner/.site-packages/language_tool/__init__.py", line 563, in get_jar_info
raise JavaError("can’t find Java")
language_tool.JavaError: can’t find Java
I've looked at some similar questions and I know I probably need to put something in 'Path' but I don't know what specifically to enter. Thanks for your help!
Also I'm on doing this on repl.it, not IDLE.
Note: I'm adding this as an actual answer because the question was resolved in the comments.
Your question says:
Also I'm on doing this on repl.it, not IDLE.
That means that you need to install this module and all its prerequisites into your repl.it environment, not into your local machine.
On the BitBucket link you provided, under "Prerequisites", the page says:
LanguageTool requires Java 6 or later.
So you will need to ensure Java is installed into your repl.it environment somehow. I don't know whether that is possible or not. Alternatively, you can simply install this package and all its prerequisites locally instead.

After starting spyder: ImportError: cannot import name 'quick_guide'

When I start spyder the internal console pops up and gives the following "traceback":
>>> WARNING:traitlets:kernel died: 6.001837253570557
Traceback (most recent call last):
File "C:\...\lib\site-packages\traitlets\traitlets.py", line 528, in get
value = obj._trait_values[self.name]
KeyError: 'banner'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\...\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch
handler(msg)
File "C:\...\lib\site-packages\qtconsole\jupyter_widget.py", line 296, in _handle_kernel_info_reply
super(JupyterWidget, self)._started_channels()
File "C:\...\lib\site-packages\qtconsole\frontend_widget.py", line 617, in _started_channels
self.reset(clear=True)
File "C:\...\lib\site-packages\qtconsole\frontend_widget.py", line 661, in reset
self._append_plain_text(self.banner)
File "C:\...\lib\site-packages\traitlets\traitlets.py", line 556, in __get__
return self.get(obj, cls)
File "C:\...\lib\site-packages\traitlets\traitlets.py", line 535, in get
value = self._validate(obj, dynamic_default())
File "C:\...\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 280, in _banner_default
return self.long_banner()
File "C:\...\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 91, in long_banner
from IPython.core.usage import quick_guide
ImportError: cannot import name 'quick_guide'
The IPython console works without problems, it is just missing the "introduction text" (python version, help-commands).
Can I just ignore this exception or is there a way to fix this manually?
(Spyder developer here) This was fixed in Spyder 3.1.4 (just released). Please update to fix it.
To fix the exception manually one needs to change the last mentioned file in the traceback. In this case this one:
File "C:\...\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 91, in long_banner
from IPython.core.usage import quick_guide
ImportError: cannot import name 'quick_guide'
and change quick_guide to quick_reference as quick_guide. One may need to restart Spyder but then the Exception disappeared.
I solved:
Only use conda install spyder=3.1.4 in your conda env.
Regards.

Error while adding new code after 3200 lines in Python using IDLE

I have a python program which works fine and has 3200 lines of code. When I try to add new lines of code in it the following error appears:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__
return self.func(*args)
File "C:\Python24\lib\idlelib\ScriptBinding.py", line 142, in run_module_event
code = self.checksyntax(filename)
File "C:\Python24\lib\idlelib\ScriptBinding.py", line 101, in checksyntax
return compile(source, filename, "exec")
SystemError: com_backpatch: offset too large

Categories