aegirhall / console-menu

A simple Python menu system for building terminal user interfaces.
MIT License
365 stars 58 forks source link

"from consolemenu.items import *" fails on latest version of python 3.7 (tested on python 3.7.9) #60

Closed HoomanTahmasebipour closed 2 years ago

HoomanTahmasebipour commented 2 years ago

The code snippet I put in the title fails on python version 3.7.9, but it works in slightly older releases of python (tested on python 3.7.4). For the sake of longevity, I was hoping that this issue could be address so that the package is compatible with the latest python release.

To recreate this issue:

  1. Create a python virtual environment and set the python version to 3.7.9
  2. Install the package following the documentation at this link: https://console-menu.readthedocs.io/en/latest/
  3. Following the same documentation, go through the commands in the "Usage" chapter and you should get a "ModuleNotFound" error when you get to the following line: "from consolemenu.items import FunctionItem, SubmenuItem, CommandItem"
  4. Create a new python virtual environment with python version 3.7.4
  5. Repeat steps 2 and 3 for this virtual environment, and you should be able to use the python package freely.

Any help on this issue would be appreciated! I have already ensured that the import path is current in later versions of python, and that the consolemenu package exists and the items directory exists within it.

Thank you in advance!

aegirhall commented 2 years ago

Hi @HoomanTahmasebipour

I was not able to reproduce this issue. I've tried 3.7.9, as well as several other versions of 3.7.x, and everything works as expected. For example, on a 3.7.9 container:

root@36f49bb122f9:/# vi menu.py
root@36f49bb122f9:/# python --version
Python 3.7.9
root@36f49bb122f9:/# python menu.py

  ┌─────────────────────────────────────────────────────────────────────────┐
  │                                                                         │
  │  Root Menu                                                              │
  │                                                                         │
  │  This is the Root Menu Subtitle                                         │
  │                                                                         │
  │                                                                         │
  │    1 - Item 1                                                           │
  │    2 - Fun item                                                         │
  │    3 - Command                                                          │
  │    4 - Submenu item                                                     │
  │    5 - Another submenu                                                  │
  │    6 - Exit                                                             │
  │                                                                         │
  │                                                                         │
  └─────────────────────────────────────────────────────────────────────────┘
  >> 6

root@36f49bb122f9:/#

Closing this issue for now, but please feel free to re-open if you're still experiencing issues.