tldr-pages / tldr-python-client

:snake: Python command-line client for tldr pages 📚
https://pypi.org/project/tldr/
MIT License
599 stars 95 forks source link

.tldr_cache prevents any meaningful output #31

Closed ghost closed 6 years ago

ghost commented 8 years ago

Hi, I just installed tldr via the python client on Xubuntu 16. Apart from serious issues with colours that make the text unreadable on every colour scheme, which I have also seen an issue regarding, I have found that the .tldr_cache directory is causing issues for reading tldr pages.

I am not great at explaining in words, so I will just show a few screenshots.

Let's say I run the command $ tldr nano. Yes, it comes up with the tldr page for nano.

However, now if I were to run the same command a second, third, fourth or even 100th time, I will not get any output anymore. I just get three lines of my console coloured with no text.

image

This is only for tldr pages that I have previously read. If I run tldr with a different page I have not yet read, it is fine.

The fix seems to be to run rm -R ~/.tldr_cache. Once I do this, everything is fine. However, it is annoying to have to keep doing this every single time I want to view a tldr page again.

image

Please excuse the text being unreadable. None of the console colour schemes included with the Xubuntu terminal are any better, and I have other stuff which works well with these console colours, so I wont change my console theme just to get tldr to be readable.

(Sorry if this is a bit vague, this is my first issue on another project).

Thanks

waldyrious commented 8 years ago

Thanks for the detailed report and screenshots @SpriteMidr! @felixonmars is the guy who will likely be able to answer meaningfully.

ghost commented 8 years ago

@waldyrious glad it is useful. I have not done a report before so I didn't want to give the wrong information. I cant tell if tldr is outputting blank lines or text the same colour as the background. I have not got my laptop charged now to find out I am afraid.

bwh1te commented 8 years ago

Hello, @SpriteMidr! Please make new screenshot of these commands:

rm -R .tldr_cache  # if exists
tldr python
ls -la .tldr_cache | grep nano
cat .tldr_cache/nano_common.md

or just post .tldr_cache/nano_common.md content here.

And what to colors... Have you tried to change colors with environment variables? 20161001_001

Yes, maybe we should change default color scheme. I think it's terrible too :)

ghost commented 8 years ago

Sorry, I had Ubuntu issues and had to reinstall.

Edit 1

As for the colours, why don't you just leave the background how it is and just highlight the text? Have a variable in the environment such as export TLDR_USE_COLOR="true" which describes whether to use colour in the command output or not? That way, if some user has decided that bright red is a good console background colour, then they can toggle it. The user has the console set to the colour scheme because that is what they work with, so when a program alters the colour scheme to show textual output, it might put them off. Plus it does kind of hurt your eyes when you are in a dark room.

Edit 2

Sorry, it seemed to take a little bit longer than I expected to get stuff working as my internet is being slow.

I have run your command on tldr in python3, using Bash on Ubuntu MATE 16.04 LTS.

image

Other system info:

$ uname -a
Linux c2q-q8200-linux 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ export | grep -i "tldr" || echo no tldr environment vars
no tldr environment vars

Thanks for getting back to me. I am still learning the Linux command line, so tldr is a great asset. (Especially when I want to know what flag to give tar to get it to gunzip a *.tar.gz blob; I don't want to read through several hundred lines of manpages to find out!) :-)

bwh1te commented 8 years ago

Oh, I'm sorry, was inattentive... Of cource nano instead of python:

rm -R ~/.tldr_cache  # if exists
tldr nano
ls -la ~/.tldr_cache | grep nano
cat ~/.tldr_cache/nano_common.md
ghost commented 8 years ago

image

I am going to go to bed now, so I won't be able to reply until tomorrow at some point.

bwh1te commented 8 years ago

Interesting. File was successfully created, but was not filled by data. Cannot reproduce this behaviour, but still trying. Judging from the colors, you have the old version of tldr. Could you please update it? If it doesn't help, please try set environment variable TLDR_CACHE_ENABLED=1.

I'll think about some refactoring to make tldr a bit more debuggable...

ghost commented 8 years ago

Is the newest update not up on the python3-pip repositories? When I ran the most recent screenshot's commands, I had literally just installed tldr from the pip3 repositores. This was on an entirely new and clean install of Ubuntu 16.04 LTS. I had switched from xubuntu to Ubuntu MATE. I have had the exact same issues on every PC I have tried this on, which is strange. I have not set any new environment variables or anything since install. It seems a bit strange at how intermittent this issue is :)

Thanks for getting back to me! I appreciate it.

NIA commented 7 years ago

@bwh1te Bump? Exactly the same here on clean Ubuntu 16.04.1 LTS. Also installed from pip3 (simply no python 2 preinstalled on this version of ubunty, only python 3). Same empty file in .tldr_cache, and same three empty blue lines as on SpriteMidr's screenshots.

Indeed, is the latest version updated in pip3 repostiories?

waldyrious commented 7 years ago

@SpriteMidr, @bwh1te and @NIA -- please confirm than the latest version on master, after merging @iliakonnov's #36, fixes this issue.

NIA commented 7 years ago

@waldyrious , I did pip3 install git+https://github.com/iliakonnov/tldr-python-client.git right now (as you wrote in comments to #36) on my machine and everything is OK! image Repeated calls work fine, file in cache dir is not empty anymore. Cool 👍 Thanks

farisachugthai commented 7 years ago

Hey just wanted to drop in reporting the same problem.

pip3 install tldr installs tldr 0.3 and running a command would empty the cache. I played around with disabling the cache, and after getting frustrated, I found this issue and NIA's comment.

Reinstalled using pip3 install git+https://github.com/iliakonnov/tldr-python-client.git And it now works perfectly!! The package at time of writing was 0.4.something.dev

Now working as expected in Termux on my Galaxy S5.

Call that tldr to go ;) hahaha!

waldyrious commented 7 years ago

Yeah, we need to make a new release to include this and other fixes. @felixonmars can you do that? (And maybe consider adding some more people as maintainers on PyPI, if your availability is limited.)

ghost commented 7 years ago

Did the PIP3 repos ever get updated for this fix? screenshot from 2017-06-14 08-56-56

Pulling tldr from python3-pip is just still producing this issue, which is weird as it seems to work fine on my laptop...

ghost commented 7 years ago

...nevermind, I just ran

sudo pip3 install git+https://github.com/iliakonnov/tldr-python-client.git

...and got my answer. It is working now :)

juliohm commented 6 years ago

Any reason why this issue is still not solved in a clean pip install? The solution was already provided in a fork, and yet every single user of the package is affected on Python 3.

Uninstalling and trying another client meanwhile...

waldyrious commented 6 years ago

@juliohm that's unfortunately blocked on #47. I'm reopening this issue until a new release is made with the fix, to make the situation clearer to end users, since it's a pretty common problem.

felixonmars commented 6 years ago

Fixed in 0.4.1.