RaitaroH / adl

🍿 anime scraper/downloader + trackma wrapper
GNU General Public License v3.0
140 stars 15 forks source link

head: illegal line count -- -2 OSX Ventura 13.4.1 #46

Closed quarterturn closed 1 year ago

quarterturn commented 1 year ago

adl seems to be having a problem with trackma when it invokes it, as the following exception is seen before adl exits:

head: illegal line count -- -2
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
trackma returned empty 'watching' list. Choose another list query. 
Available queries: watching, completed, rewatching, paused, dropped, plantowatch;

Using tee when running adl gets a little more information:

Platform:Windows
ESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[HESC[2JESC[3JESC[;36mtrackma returned empty 'watching' list. Choose another list query. ESC[0m
Available queries: watching, completed, rewatching, paused, dropped, plantowatch;
adl.error (END)

'git show' for adl:

adl % git show
commit ed469f43f1f8aaa2a90f974bed1094ba875c78f5 (HEAD -> master, origin/master, origin/HEAD)
Author: RaitaroHikami <19552720+RaitaroH@users.noreply.github.com>
Date:   Thu Feb 23 18:55:28 2023 +0000

    fix for 3.2.4

    copy paste issue

macports bash version:

bash -v
bash-5.2$ 

trackma version:

trackma
Trackma v0.8.6  Copyright (C) 2012-2023  z411

trackma is configured with some shows:

quarterturn [anilist] (anime) watching >> list
| Index  Title                                                Progress  Score  |
|   1    Mushoku Tensei: Jobless Reincarnation Season 2......   6 / 13    0    |
|   2    Rurouni Kenshin.....................................   5 / 94    0    |
2 results
RaitaroH commented 1 year ago

I believe the issue is this line. Can you try on your end trackma -a 1 list | head -n -2 ?

Some implementations of head like GNU head support negative arguments for -n. It is likely that on OSX Ventura it does not. As such this line fails.

If that is the case then commands such as adl -v will also fail, the change_providers, check_for_updates too.

RaitaroH commented 1 year ago

I suppose the easiest workaround for this would be something like this:

trackma -a 1 list | sed '$d' | sed '$d'

I might find a more efficient solution, but I would like you to test this command to see if it works on your system.

quarterturn commented 1 year ago

Yeah it's even in the newer macports bash:

bash-5.2$ trackma -a 1 list | head -n -2
head: illegal line count -- -2
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
bash-5.2$ trackma -a 1 list | sed '$d' | sed '$d'
| Index  Title                                           Progress  Score  |
|   1    Mushoku Tensei: Jobless Reincarnation Season 2.   6 / 13    0    |
|   2    Rurouni Kenshin................................   5 / 94    0    |
bash-5.2$ 
RaitaroH commented 1 year ago

I have made a different branch for this issue. You can see it above. I have also tested on my system and it appears to be working as expected, but I would like you to test the changes and see if adl works for you.

quarterturn commented 1 year ago

It is now working. Thank you.