Python Forum
Error on first Python launch - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Error on first Python launch (/thread-42082.html)



Error on first Python launch - garryp4 - May-06-2024

I just installed Python 3.12 and get errors in the in the Command Prompt window when launching.

Here is a cut / paste:

Microsoft Windows [Version 10.0.19045.4355]
© Microsoft Corporation. All rights reserved.

C:\Users\Owner>py
Python 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
File "<frozen site>", line 450, in register_readline
File "E:\Python312\Lib\site-packages\readline.py", line 34, in <module>
rl = Readline()
^^^^^^^^^^
File "E:\Python312\Lib\site-packages\pyreadline\rlmain.py", line 422, in __init__
BaseReadline.__init__(self)
File "E:\Python312\Lib\site-packages\pyreadline\rlmain.py", line 62, in __init__
mode.init_editing_mode(None)
File "E:\Python312\Lib\site-packages\pyreadline\modes\emacs.py", line 633, in init_editing_mode
self._bind_key('space', self.self_insert)
File "E:\Python312\Lib\site-packages\pyreadline\modes\basemode.py", line 162, in _bind_key
if not callable(func):
^^^^^^^^^^^^^^
File "E:\Python312\Lib\site-packages\pyreadline\py3k_compat.py", line 8, in callable
return isinstance(x, collections.Callable)
^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Callable'
>>>



I'm new to Python.
Thanks


RE: Error on first Python launch - sawtooth500 - May-07-2024

I'm guessing you tried restarting, correct?

Did you use the official windows python installer from python.org? I'd recommend trying to reinstall with that installer.


RE: Error on first Python launch - snippsat - May-07-2024

Have you installed pyreadline?
If so pip uninstall pyreadline.
If not install with pip,just remove this file E:\Python312\Lib\site-packages\readline.py and try again.
readline.py is not part of Python default iinstall files,as it belong to pyreadline if look at file readline.py.
So dos it hook into low level stuff and can make this error.


RE: Error on first Python launch - garryp4 - May-07-2024

(May-07-2024, 06:53 AM)snippsat Wrote: Have you installed pyreadline?
If so pip uninstall pyreadline.
If not install with pip,just remove this file E:\Python312\Lib\site-packages\readline.py and try again.
readline.py is not part of Python default iinstall files,as it belong to pyreadline if look at file readline.py.
So dos it hook into low level stuff and can make this error.



RE: Error on first Python launch - garryp4 - May-07-2024

Thanks you snippsat. I installed Python with the download Python.org/downloads. Removing the readline.py fixed the problem.


RE: Error on first Python launch - deanhystad - May-07-2024

What did you install? 64-bit, ARM64, embeddable?