peterbrittain / asciimatics

A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Apache License 2.0
3.64k stars 238 forks source link

sample/basics.py error "No module named 'asciimatics'" in pipenv shell under a Win10-64 CMD.EXE shell #312

Closed pjfarleyiii closed 3 years ago

pjfarleyiii commented 3 years ago

Describe the bug sample/basics.py will not run in pipenv shell under Windows Terminal CMD.EXE shell but does run under an Ubuntu WSL2 shell

To Reproduce

  1. Set up pipenv in a test directory under Windows 10-64 using a Windows Terminal CMD.EXE window
  2. Install asciimatics there (pip install asciimatics)
  3. Copy asciimatics/sample/basics.py to the test directory
  4. Run basics.py from the pipenv shell command prompt

Expected behavior sample/basics.py should run in the CMD.EXE terminal window.

Screenshots (envtest) C:\envtest>basics.py Traceback (most recent call last): File "C:\envtest\basics.py", line 7, in from asciimatics.effects import Cycle, Print, Stars ModuleNotFoundError: No module named 'asciimatics'

System details (please complete the following information):

Windows 10-64 Build 19041.928 Python 3.8.9 (tags/v3.8.9:a743f81, Apr 6 2021, 14:02:34) [MSC v.1928 64 bit (AMD64)] Asciimatics version 1.13.0

pip list: Package Version


asciimatics 1.13.0 bullet 2.2.0 click 7.1.2 colorama 0.4.4 commonmark 0.9.1 future 0.18.2 numpy 1.20.1 Pillow 8.2.0 pip 20.3.3 pyfiglet 0.8.post1 Pygments 2.8.1 PySimpleGUI 4.39.1 pywin32 300 rich 10.1.0 setuptools 49.6.0 six 1.15.0 typing-extensions 3.7.4.3 wcwidth 0.2.5 wheel 0.35.1 windows-curses 2.2.0 ycecream 1.1.6

Additional context sample/basics.py does work in an Ubuntu 20.4 terminal using Python 3.8.5 under WSL2 inside of a pipenv shell

cat /etc/os-release NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.2 LTS" VERSION_ID="20.04"

python3 -VV Python 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]

peterbrittain commented 3 years ago

My guess is that running basics.py like that is picking up the wrong interpreter on Windows. Have you tried running python basics.py instead, or checking which interpreter is actually getting invoked?

pjfarleyiii commented 3 years ago

I figured it out. As you suggested, running it as python basics.py works just fine because that then ignores the she-bang line in basics.py, which specifies:

!/usr/bin/env python3

and the gnuwin32 port of the which command reports:

(envtest) C:\envtest>which python3 C:\Users\Myusername\AppData\Local\Microsoft\WindowsApps\python3.EXE

Which if you try to actually run it prompts you to go the the M$ store and install python from there!

GR-R-R-R! Bloody M$ idiots strike again.

Apologies for the false alarm. I'll remove or change the she-bang lines in the samples directory to get around this M$ nonsense.

Please close as ""Stoopid M$ tricks".

Peter