Python idle no work

Hello,

I am new to Archlinux based distributions. I have recently installed Endeavor OS 22.9 and I am going to start an online Python 3 programming course that uses IDLE as the first development environment but on my machine when I run idle it tells me the following:

> [tjay@archie ~]$ idle
> Traceback (most recent call last):
>   File "/usr/bin/idle", line 3, in <module>
>     from idlelib.pyshell import main
>   File "/usr/lib/python3.10/idlelib/pyshell.py", line 53, in <module>
>     from idlelib import debugger
>   File "/usr/lib/python3.10/idlelib/debugger.py", line 7, in <module>
>     from idlelib import macosx
>   File "/usr/lib/python3.10/idlelib/macosx.py", line 7, in <module>
>     from test.support import requires, ResourceDenied
> ModuleNotFoundError: No module named 'test'
> [tjay@archie ~]$

Can someone tell me how or what to install so that idle works on my installation?

try this:

yay -S idle

Then launch it from the menu.

If you want to launch it from the command line, you need to pass a python file. i.e. idle test.py

1 Like

I get the same result (the text is in Spanish but I assume you understand the process):

[tjay@archie ~]$ yay -S idle
:: Buscando conflictos...
:: Buscando conflictos internos...
[Aur:1]  idle-3.10.8-3

:: (1/1) PKGBUILD Descargado : idle
  1 idle                             (Archivos de compilación existen)
==> ¿Diffs a mostrar?
==> [N]inguno [A]Todos [Ab]ortar [I]nstalados [No]Instalados o (1 2 3, 1-3, ^4)
==> 1
diff --git /home/tjay/.cache/yay/idle/.gitignore /home/tjay/.cache/yay/idle/.gitignore
new file mode 100644
index 0000000..b739055
--- /dev/null
+++ /home/tjay/.cache/yay/idle/.gitignore
@@ -0,0 +1,13 @@
+*.tar
+*.tar.*
+*.jar
+*.exe
+*.msi
+*.zip
+*.tgz
+*.log
+*.log.*
+*.sig
+
+pkg/
+src/
diff --git /home/tjay/.cache/yay/idle/PKGBUILD /home/tjay/.cache/yay/idle/PKGBUILD
new file mode 100644
index 0000000..582b7a2
--- /dev/null
+++ /home/tjay/.cache/yay/idle/PKGBUILD

:: ¿Proceder con la instalación? [S/n] 
:: (1/1) Analizando SRCINFO: idle
==> Creando el paquete: idle 3.10.8-3 (mar 18 oct 2022 20:39:41)
==> Recibiendo las fuentes...
  -> idle.desktop ha sido encontrado
==> Validando los archivos source con sha256sums...
    idle.desktop ... Aprobado
==> Creando el paquete: idle 3.10.8-3 (mar 18 oct 2022 20:39:42)
==> Comprobando dependencias mientras se ejecuta...
==> Comprobando dependencias mientras se compila...
==> Recibiendo las fuentes...
  -> idle.desktop ha sido encontrado
==> Validando los archivos source con sha256sums...
    idle.desktop ... Aprobado
==> Eliminando el directorio $srcdir/...
==> Extrayendo las fuentes...
==> Las fuentes están listas.
==> Creando el paquete: idle 3.10.8-3 (mar 18 oct 2022 20:39:44)
==> Comprobando dependencias mientras se ejecuta...
==> Comprobando dependencias mientras se compila...
==> ADVERTENCIA: Usando el árbol existente $srcdir/
==> Entrando en entorno fakeroot...
==> Iniciando package()...
==> Depurando la instalación...
  -> Quitando los archivos libtool...
  -> Purgando los archivos innecesarios...
  -> Quitando los archivos de las bibliotecas estáticas...
  -> Despojando los símbolos innecesarios de los binarios y de las bibliotecas...
  -> Comprimiendo las páginas del manual y de información...
==> Buscando problemas de empaquetado...
==> Creando el paquete «idle»...
  -> Generando el archivo .PKGINFO...
  -> Generando el archivo .BUILDINFO...
  -> Generando el archivo .MTREE...
  -> Comprimiendo el paquete...
==> Abandonando el entorno fakeroot.
==> Compilación terminada: idle 3.10.8-3 (mar 18 oct 2022 20:39:46)
==> Limpiando...
cargando los paquetes...
resolviendo dependencias...
buscando conflictos entre paquetes...

Paquete (1)  Versión nueva  Diferencia neta

idle         3.10.8-3              0,00 MiB

Tamaño total de la instalación:  0,00 MiB

:: ¿Continuar con la instalación? [S/n] 
(1/1) comprobando las claves del depósito                    [--------------------------------] 100%
(1/1) verificando la integridad de los paquetes              [--------------------------------] 100%
(1/1) cargando los archivos de los paquetes                  [--------------------------------] 100%
(1/1) comprobando conflictos entre archivos                  [--------------------------------] 100%
:: Procesando los cambios de los paquetes...
(1/1) instalando idle                                        [--------------------------------] 100%
:: Ejecutando los «hooks» de posinstalación...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating icon theme caches...
(3/3) Updating the desktop file MIME type cache...

When I run it through the XFCE4 menu nothing appears. When I run it from a terminal (xfce4-terminal) it keeps saying the same thing:

[tjay@archie ~]$ idle
Traceback (most recent call last):
  File "/usr/bin/idle", line 3, in <module>
    from idlelib.pyshell import main
  File "/usr/lib/python3.10/idlelib/pyshell.py", line 53, in <module>
    from idlelib import debugger
  File "/usr/lib/python3.10/idlelib/debugger.py", line 7, in <module>
    from idlelib import macosx
  File "/usr/lib/python3.10/idlelib/macosx.py", line 7, in <module>
    from test.support import requires, ResourceDenied
ModuleNotFoundError: No module named 'test'
[tjay@archie ~]$

The funny thing is that I have a machine at work that was my first installation of Endeavor OS and I only needed to install the ‘tk’ package to get ‘idle’ to work. I have verified that both have the same python packages and in one it works and in the other it doesn’t… goblins… :stuck_out_tongue_winking_eye:

It’s a bug. If you can’t wait for a fix to be pushed there’s a fix on this thread

I have no problem waiting for an official fix… I can always use a virtual machine with my usual Debian to be able to continue with the Python course…

Thanks for the info :slight_smile:

I mean you’re trying to learn python anyway right? This should be all you have to do:
But, no worries I can’t imagine it should take very long to update on your machine since they closed it. Guess it’ll depend when they push the next version out. shrug

Fix 1: edit Lib/idlelib/macosx.py by making line 7 a comment and replacing line 23 with pass so that lines 4-25 become

(your file location looks like it’s here: /usr/lib/python3.10/idlelib/macosx.py)

from os.path import expanduser
import plistlib
from sys import platform  # Used in _init_tk_type, changed by test.
# from test.support import requires, ResourceDenied  # <- line 7 now a comment

import tkinter


## Define functions that query the Mac graphics type.
## _tk_type and its initializer are private to this section.

_tk_type = None

def _init_tk_type():
    """ Initialize _tk_type for isXyzTk functions.
    """
    global _tk_type
    if platform == 'darwin':
        try:
            pass  # <- line 23 replacement
        except ResourceDenied:  # Possible when testing.
            _tk_type = "cocoa"  # Newest and most common.