Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weird escape chars instead of lines #114

Open
gilbh opened this issue Dec 28, 2020 · 5 comments
Open

weird escape chars instead of lines #114

gilbh opened this issue Dec 28, 2020 · 5 comments

Comments

@gilbh
Copy link

gilbh commented Dec 28, 2020

two problems:

  1. I just installed with pip and ran a test script for hook. Odd results. This is in Windows 10 command line:
(utils) C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python>pip install frosch
Collecting frosch
  Downloading frosch-0.1.7-py3-none-any.whl (14 kB)
Collecting asttokens<3.0.0,>=2.0.4
  Downloading asttokens-2.0.4-py2.py3-none-any.whl (20 kB)
Requirement already satisfied: six in c:\users\gil\envs\utils\lib\site-packages (from asttokens<3.0.0,>=2.0.4->frosch) (1.15.0)
Collecting colorama<0.5.0,>=0.4.4
  Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting Pygments<3.0.0,>=2.7.2
  Downloading Pygments-2.7.3-py3-none-any.whl (950 kB)
     |████████████████████████████████| 950 kB 2.2 MB/s
Collecting pytest-sugar<0.10.0,>=0.9.4
  Downloading pytest-sugar-0.9.4.tar.gz (12 kB)
Requirement already satisfied: termcolor>=1.1.0 in c:\users\gil\envs\utils\lib\site-packages (from pytest-sugar<0.10.0,>=0.9.4->frosch) (1.1.0)
Requirement already satisfied: packaging>=14.1 in c:\users\gil\envs\utils\lib\site-packages (from pytest-sugar<0.10.0,>=0.9.4->frosch) (20.4)
Requirement already satisfied: pyparsing>=2.0.2 in c:\users\gil\envs\utils\lib\site-packages (from packaging>=14.1->pytest-sugar<0.10.0,>=0.9.4->frosch) (2.4.7)
Collecting pytest>=2.9
  Downloading pytest-6.2.1-py3-none-any.whl (279 kB)
     |████████████████████████████████| 279 kB 3.2 MB/s
Requirement already satisfied: attrs>=19.2.0 in c:\users\gil\envs\utils\lib\site-packages (from pytest>=2.9->pytest-sugar<0.10.0,>=0.9.4->frosch) (19.3.0)
Requirement already satisfied: toml in c:\users\gil\envs\utils\lib\site-packages (from pytest>=2.9->pytest-sugar<0.10.0,>=0.9.4->frosch) (0.10.1)
Collecting atomicwrites>=1.0
  Downloading atomicwrites-1.4.0-py2.py3-none-any.whl (6.8 kB)
Collecting pluggy<1.0.0a1,>=0.12
  Downloading pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
Collecting py>=1.8.2
  Downloading py-1.10.0-py2.py3-none-any.whl (97 kB)
     |████████████████████████████████| 97 kB 3.2 MB/s
Collecting stack-data<0.2.0,>=0.1.0
  Downloading stack_data-0.1.0-py3-none-any.whl (20 kB)
Collecting yapf<0.31.0,>=0.30.0
  Downloading yapf-0.30.0-py2.py3-none-any.whl (190 kB)
     |████████████████████████████████| 190 kB 3.3 MB/s
Collecting executing
  Downloading executing-0.5.4-py3-none-any.whl (12 kB)
Collecting iniconfig
  Downloading iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
Collecting pure-eval
  Downloading pure_eval-0.1.1-py3-none-any.whl (9.4 kB)
Building wheels for collected packages: pytest-sugar
  Building wheel for pytest-sugar (setup.py) ... done
  Created wheel for pytest-sugar: filename=pytest_sugar-0.9.4-py2.py3-none-any.whl size=8977 sha256=450a8aee9c6f1418955904f4d15e157340f920f76b40aa093f652d3e3880ce9f
  Stored in directory: c:\users\gil\appdata\local\pip\cache\wheels\11\15\a5\18fe38a58318bf4aa4bc15c369d8dd7ec9210164812c48b8ba
Successfully built pytest-sugar
Installing collected packages: py, pluggy, iniconfig, colorama, atomicwrites, pytest, pure-eval, executing, asttokens, yapf, stack-data, pytest-sugar, Pygments, frosch
  Attempting uninstall: colorama
    Found existing installation: colorama 0.4.3
    Uninstalling colorama-0.4.3:
      Successfully uninstalled colorama-0.4.3
  Attempting uninstall: Pygments
    Found existing installation: Pygments 2.6.1
    Uninstalling Pygments-2.6.1:
      Successfully uninstalled Pygments-2.6.1
Successfully installed Pygments-2.7.3 asttokens-2.0.4 atomicwrites-1.4.0 colorama-0.4.4 executing-0.5.4 frosch-0.1.7 iniconfig-1.1.1 pluggy-0.13.1 pure-eval-0.1.1 py-1.10.0 pytest-6.2.1 pytest-sugar-0.9.4 stack-data-0.1.0 yapf-0.30.0

(utils) C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python>p test_frosch.py
�[38;5;26mTraceback (most recent call last):�[39m
�[38;5;252m  File �[39m�[38;5;5m"C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python\test_frosch.py"�[39m�[38;5;252m, line �[39m�[38;5;5m4�[39m�[38;5;252m, in �[39m�[38;5;252m<module>�[39m
�[38;5;252m    �[39m�[38;5;252mx�[39m�[38;5;252m �[39m�[38;5;68m=�[39m�[38;5;252m �[39m�[38;5;5m3�[39m�[38;5;252m �[39m�[38;5;68m+�[39m�[38;5;252m �[39m�[38;5;1m'�[39m�[38;5;1masdf�[39m�[38;5;1m'�[39m
�[38;5;9mTypeError�[39m�[38;5;252m: �[39m�[38;5;252munsupported operand type(s) for +: 'int' and 'str'�[39m

 4 �[34m||�[0m �[38;5;252mx�[39m�[38;5;252m �[39m�[38;5;68m=�[39m�[38;5;252m �[39m�[38;5;5m3�[39m�[38;5;252m �[39m�[38;5;68m+�[39m�[38;5;252m �[39m�[38;5;1m'�[39m�[38;5;1masdf�[39m�[38;5;1m'�[39m
   �[34m||�[0m │
   �[34m||�[0m └── �[38;5;252mx�[39m�[38;5;252m �[39m�[38;5;68m=�[39m�[38;5;252m �[39m�[38;5;3mNone�[39m
   �[34m||�[0m

Here's the code of test_frosch.py:

from frosch import hook

# hook(theme='vim')
hook()
x = 3 + 'asdf'

When I try to run with IPython inside nvim Terminal -- nothing happens at all (as if the hook() does not, well, hook):

(utils) C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python
>ipython --pprint
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit
Type 'copyright', 'credits' or 'license' for more information
IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

In [4]: %run "C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities
   ...: \Python\test_frosch.py"
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python\test_frosch
.py in <module>
      3 # hook(theme='vim')
      4 hook()
----> 5 x = 3 + 'asdf'

TypeError: unsupported operand type(s) for +: 'int' and 'str'

In [5]:

Thanks!

@gilbh gilbh changed the title weird escape chars installed of lines weird escape chars instead of lines Dec 28, 2020
@Qix-
Copy link
Owner

Qix- commented Dec 29, 2020

Windows 10 command line

Which terminal emulator? cmd.exe, Windows Terminal, powershell, etc.

inside nvim Terminal

Can you expand on this? Which environment are you running? By nvim do you mean neovim?

@gilbh
Copy link
Author

gilbh commented Dec 29, 2020

This happens on my two computers, both run Windows 10, through the cmd.exe.
Yes, nvim is neovim, but that is not what causes the issue. The screen shot shows both failures from the cmd.exe, the first with python and the second with ipython:
image

I am running Python 3.8.6 inside a virtualenv.

@gilbh
Copy link
Author

gilbh commented Dec 29, 2020

You can see in the above screen shot:

  1. for python, the characters come out wrong.
  2. for ipython, there is no hook.

@Qix-
Copy link
Owner

Qix- commented Dec 29, 2020

cmd.exe doesn't support ansi escape characters. Switch to Microsoft Terminal (from the app store). Not only is it faster but it's the all around better option. It's the new official terminal by Microsoft. It'll support all of the ansi escapes.

@gilbh
Copy link
Author

gilbh commented Dec 29, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants