Giter Site home page Giter Site logo

Comments (21)

snowiow avatar snowiow commented on August 20, 2024 1

Hi can you please edit your message, so that your code is inside code markup? Have a look here if you don't know how to do it. Thanks

from i3blocks-contrib.

snowiow avatar snowiow commented on August 20, 2024 1

thanks :) I will have a look into it

from i3blocks-contrib.

snowiow avatar snowiow commented on August 20, 2024 1

if you change the python script in the yaourt -Qua line as follows:
output = check_output(['yaourt', '-Su', '--aur']).decode('utf-8')
do you get an update messge in your bar?

from i3blocks-contrib.

snowiow avatar snowiow commented on August 20, 2024 1

It wasn't really a problem with the script itself. The problem was that -Qua returned a non 0 status code. The python subprocess module interpretes that as an error and so the script was aborted. Normally yaourt -Qua should also exit with a 0 status code when it has no updates like -Su does. So there are two ways. To keep the -Su argument or catch the exception and check if the catched error is infact empty and go on, because it wasn't a real error

from i3blocks-contrib.

snowiow avatar snowiow commented on August 20, 2024 1

No you are right 😄 . But I'm still fiddling around, what will be the best solution to that problem. I will give you an update here, if the code is updated in the repository

from i3blocks-contrib.

snowiow avatar snowiow commented on August 20, 2024 1

problem will be fixed with #97

from i3blocks-contrib.

snowiow avatar snowiow commented on August 20, 2024 1

Yes I liked that solution more than the first one. Glad it's working now. Thanks for your help

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

I am sorry for the appearance of my message, I don't know why I can't just deactivate this "text formatting" bs :(

And I'd also like to apologize for any English mistakes I may have done, English is not my mothertongue. As you might see on my screenshot, I'm French.

Thanks in advance for any help you might give me! :)

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

Hi snowiow,

I'll get on that right now, thanks for answering :) 👍

EDIT : DONE. Thanks for your link!

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

Hey I've got some news :

When I take the -a out of the command in i3blocks.conf, everything works.

Odd thing is : yaourt in installed and running on my arch system. I often use it, I have aur packages... so WTH ?

from i3blocks-contrib.

snowiow avatar snowiow commented on August 20, 2024

Yes the problem is that yaourt exits with a non zero status when it has no updates. Python subprocess thinks there was an error during the execution und raises it

from i3blocks-contrib.

snowiow avatar snowiow commented on August 20, 2024
def get_aur_update_count():
    output = ''
    try:
        output = check_output(['yaourt', '-Qua']).decode('utf-8')
    except subprocess.CalledProcessError as e:
        print("Ping stdout output:\n", e.output)
    if not output:
        return 0

    aur_updates = [line
                   for line in output.split('\n')
                   if line.startswith('aur/')]

    return len(aur_updates)

you can check yourself, if you update the method like this

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

I just tried "yaourt -Qua" and it seems to be working just find, no output at all because no update is available. This situation is expected in the py script :

    if not output:
        return 0

So I'm wondering : why is this not working?

EDIt : Just saw your post up this one, I'll try this out right now, thanks

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

Alright so I tried and edited my py script, added your modification, then restarted i3.

Nothing appears on top no more. I have one update available, so the script's sending back to me  1, but nothing on the bar. :(

This is just odd.

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

After a few tests, I can confirm that, at least, without the -a option, everything works just fine, so the issue is definitly about yaourt and AUR updates.

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

So this is how my codes look like right now :

def get_aur_update_count():
    output = ''
    try:
        output = check_output(['yaourt', '-Su', '--aur']).decode('utf-8')
    except subprocess.CalledProcessError as e:
        print("Ping stdout output:\n", e.output)
    if not output:
        return 0

    aur_updates = [line
                   for line in output.split('\n')
                   if line.startswith('aur/')]

    return len(aur_updates)
[arch-update]
command=/usr/lib/i3blocks/arch-update.py -a -b "#FFFFFF" -u "#FF0000"
interval=600
markup=pango

And... it seems to work fine! I mean, I do not have any update available for now, but I do have the update status in my bar, right how and where it should be!

Thanks a lot for your help, man. May I ask, because I am no python expert, what was wrong with the script in the first place?

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

Well, sir, you obviously are much better in Python than I am. I'm still learning tho.

Thanks for the explanation, thanks for answering me, and resolving my issue.

I'm wondering... The modification you made... Shouldn't it be put in the default script, so that other users can benefit from it?

Sorry if I'm saying nonsense, I'm quite new to github too.

from i3blocks-contrib.

kb100 avatar kb100 commented on August 20, 2024

@snowiow Thanks for handling this one. If you think this may be a common issue, I would merge the fix for it, and @Pxmme if your issue is resolved please close the issue.

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

Hey, anyway, thanks again man. I really appreciate how quick you helped me.

I guess I have to put this issue in "resolved" mode now... Let's see how to do that. :)

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

Yay! Done, @kb100 👍

from i3blocks-contrib.

Pxmme avatar Pxmme commented on August 20, 2024

@snowiow I updated my arch-update.py with the #97 modifications you made, since they were a little bit different from the solution you offered me here 👍

Everything seems to work just fine!

Merci encore :)

from i3blocks-contrib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.