How can I solve Python IDLE3 start problem? - python

friends...
I've just installed IDLE3 package for Python (running Python 3.8)...
When I try to start it there is a message like this:
[ibmsys01#gustavo-ubuntu ~/zPDT]$ idle
** Invalid host: ('192.168.0.17', 57676)
Traceback (most recent call last):
File "/usr/bin/idle", line 5, in <module>
main()
File "/usr/lib/python3.8/idlelib/pyshell.py", line 1516, in main
shell = flist.open_shell()
File "/usr/lib/python3.8/idlelib/pyshell.py", line 331, in open_shell
if not self.pyshell.begin():
File "/usr/lib/python3.8/idlelib/pyshell.py", line 1049, in begin
client = self.interp.start_subprocess()
File "/usr/lib/python3.8/idlelib/pyshell.py", line 465, in start_subprocess
self.rpcclt.accept()
File "/usr/lib/python3.8/idlelib/rpc.py", line 544, in accept
raise OSError
OSError
[ibmsys01#gustavo-ubuntu ~/zPDT]$
I haven't found any reference to this error. Has any of you seen it before? Can you please help get through it?
My environment is:
Linux Ubuntu 20.04 LTS
Python 3.8.5
IDLE3
An additional detail: invoking "idle" or "idle3" gives me the same error.
Can you please help me get through this?
Thank you and best regards.
Gustavo.

Related

Get exception when just started py script, but all work

Interesting situation!
I has parser.py script, link to it below in 1, with feedparser library.
When i just started it, i get such exceptions:
Connected to pydev debugger (build 172.3757.67)
pydev debugger: process 20017 is connecting
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_vars.py", line 354, in evaluate_expression
compiled = compile(expression, '<string>', 'eval')
File "<string>", line 1
feedparser.parse(http://www.malware-traffic-analysis.net/blog-entries.rss)
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 1134, in do_it
result = pydevd_vars.evaluate_expression(self.thread_id, self.frame_id, self.expression, self.doExec)
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_vars.py", line 356, in evaluate_expression
Exec(expression, updated_globals, frame.f_locals)
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "<string>", line 1
feedparser.parse(http://www.malware-traffic-analysis.net/blog-entries.rss)
^
SyntaxError: invalid syntax
Even more, i didn't go to point with:
feedparser.parse(http://www.malware-traffic-analysis.net/blog-entries.rss)
Such problem appear over first import in script which import json!
Also in my code i get http strings from txt file, like:
RssProcess('rsslinks.txt')
So, first i thing that problem in this file and delete string
http[:]//www.malware-traffic-analysis.net/blog-entries.rss
from it. But it didn't help! So i has script that works perfectly, but it get exceptions which doesn't stop it. Exceptions i saw in PyCharm debugger.
My specs:
macOS Sierra 10.12.6
pycharm 2017.2
python 3.6.2
Link to GitHub

Python error ValueError: substring not found

I have no experience with python and I am installing a mongodb tools from https://github.com/rueckstiess/mtools. After installation and launch the application I got below exception errors. It seems that there is a grama issue but I am not sure about it. Is it caused by python version? I am using python 2.7. How can I know which version fix this problem?
# mlaunch init --single
Traceback (most recent call last):
File "/usr/local/bin/mlaunch", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 1438, in main
tool.run()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 260, in run
getattr(self, self.args['command'])()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 280, in init
current_version = self.getMongoDVersion()
File "/usr/local/lib/python2.7/dist-packages/mtools/mlaunch/mlaunch.py", line 475, in getMongoDVersion
if current_version.rindex('v') > 0:
ValueError: substring not found

Python3 and Pyglet - help needed

I am a newbie of Python and Pyglet. I just installed Pyglet on my Linux and Window7. I run a very simple test file on my Linux, I got errors
(On linux: Python 3.5.2 Pyglet 1.2.4)
The following is the test file-tests.py:
import pyglet
window = pyglet.window.Window()
pyglet.app.run()
I got the following errors when I run it on my Linux:
Traceback (most recent call last):
File "/home/work/.local/lib/python3.5/site-packages/pyglet/init.py", line 351, in getattr return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'Window'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "test.py", line 6, in <module> window = pyglet.window.Window() File "/home/work/.local/lib/python3.5/site-packages/pyglet/init.py", line 357, in getattr import(import_name)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/init.py", line 1816, in <module> gl._create_shadow_window()
File "/home/work/.local/lib/python3.5/site-packages/pyglet/gl/init.py", line 205, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 163, in init super(XlibWindow, self).init(args, *kwargs)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/init.py", line 558, in init self._create()
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 353, in _create self.set_caption(self._caption)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 513, in set_caption self._set_text_property('_NET_WM_NAME', caption)
File "/home/work/.local/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 783, in _set_text_property raise XlibException('Could not create UTF8 text property')
pyglet.window.xlib.XlibException: Could not create UTF8 text property*
This test file works ok on my Win7
(On Window7: Python 3.6.0 Pyglet 1.2.4)
Please help if you know why. Thanks.
As we figured out from the comments above, it looked like the installation output printed some odd symbols. That and the fact that pyglet had problem loading UTF-8 context lead me to believe that there were no UTF-8 support generated in the OS.
Usually, you can uncomment en_US.UTF-8 in /etc/locale.conf and run locale-gen and that should solve the problem.
in your terminal
write LANG=en_US
Run your python code from the terminal
another solution by placing it before everything of your code
import os
os.environ['LANG']='en_US'
edit your /etc/default/locale, and try to feed all locale critiria as the same:
# File generated by update-locale
LANG=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=en_US.UTF-8
Use sudo dpkg-reconfigure locales to set your own language. Make sure to mark en_US.UTF-8 selection.
sudo locale-gen en_US en_US.UTF-8
Reboot

Python 3.3.5 Console does not start in PyCharm 2016.3.1

Please, could you help? I am unable to get the python console started in PyCharm. Have played with all option available and have trawled through the documentation, but cannot figure this one out. Any help would be appreciated. Please find below the error I get in the console...
OS: Win 10
C:\Miniconda3\python.exe "C:\Program Files (x86)\JetBrains\PyCharm\helpers\pydev\pydevconsole.py" 64331 64332
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\traitlets\traitlets.py", line 526, in get
value = obj._trait_values[self.name]
KeyError: None
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm\helpers\pydev\pydevconsole.py", line 526, in <module>
pydevconsole.start_server(pydev_localhost.get_localhost(), int(port), int(client_port))
File "C:\Program Files (x86)\JetBrains\PyCharm\helpers\pydev\pydevconsole.py", line 355, in start_server
interpreter = InterpreterInterface(host, client_port, threading.currentThread())
File "C:\Program Files (x86)\JetBrains\PyCharm\helpers\pydev\_pydev_bundle\pydev_ipython_console.py", line 25, in __init__
self.interpreter = get_pydev_frontend(host, client_port, show_banner=show_banner)
File "C:\Program Files (x86)\JetBrains\PyCharm\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 488, in get_pydev_frontend
_PyDevFrontEndContainer._instance = _PyDevFrontEnd(show_banner=show_banner)
File "C:\Program Files (x86)\JetBrains\PyCharm\helpers\pydev\_pydev_bundle\pydev_ipython_console_011.py", line 318, in __init__
self.ipython = PyDevTerminalInteractiveShell.instance()
File "C:\Miniconda3\lib\site-packages\IPython\config\configurable.py", line 337, in instance
inst = cls(*args, **kwargs)
File "C:\Miniconda3\lib\site-packages\IPython\core\interactiveshell.py", line 512, in __init__
self.init_readline()
File "C:\Miniconda3\lib\site-packages\IPython\core\interactiveshell.py", line 1911, in init_readline
if self.readline_use:
File "C:\Miniconda3\lib\site-packages\traitlets\traitlets.py", line 554, in __get__
return self.get(obj, cls)
File "C:\Miniconda3\lib\site-packages\traitlets\traitlets.py", line 532, in get
% (self.name, obj))
traitlets.traitlets.TraitError: No default value found for None trait of <_pydev_bundle.pydev_ipython_console_011.PyDevTerminalInteractiveShell object at 0x00000000042CFBA8>
Process finished with exit code 1
Ok, after much twiddling about:
Changing the interpreter to a different version (to Python 3.5.x) made this work. This made me wonder if IPython was the issue.. and it sure was!!
The problem is that the IPython for Python 3.3.5 does not work with PyCharm. IPython Version 5 was installed by PyCharm, but does not work with Python 3.3.5.
I removed IPython using 'Conda uninstall' and then 'Conda clean' and restarted the console, it then worked like a charm...
In essence:
1. Exit Pycharm
2. Remove IPython - use 'Conda remove/uninstall' and then 'conda clean' to completely get rid of it.
3. Restart Pycharm and allow it reimport all 'skeletons'
4. Restart Console.
I had a similar problem on Fedora 24. For some reason Fedora still ships IPython 3.x :/ I simply upgraded it with pip3 install ipython --upgrade which installed IPython 6.0.0 and it works :D

Unable to start python on mac

I have been working with python on my laptop and noticed that since this morning python does not execute any scripts anymore. With little debugging I realized that python does not even start its prompt on my workspace. I am using python 2.7 below:
Pranav-Mac:[~]$ python
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 548, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 527, in main
known_paths = removeduppaths()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 110, in removeduppaths
dir, dircase = makepath(dir)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 80, in makepath
dir = os.path.join(*paths)
AttributeError: 'module' object has no attribute 'path'
Pranav-Mac:[~]$ echo $PYTHONPATH
/Users/pranav/mylib
Pranav-Mac:[~]$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/mysql/bin
Pranav-Mac:[~]
So I tried reinstalling python 2.7.11 which did not fix the issue.
Any clue what could have gone wrong here ?
Deleted all old *.pyc files from my mac to fix this issue.

Categories