Py3status: group module cannot be loaded

Created on 3 Aug 2016  ·  18Comments  ·  Source: ultrabug/py3status

I am using the master branch. I simply put the example in the doc:

# Create a disks group that will show space on '/' and '/home'
# Change between disk modules every 30 seconds
...
order += "group disks"
...

group disks {
    cycle = 30
    format = "Disks: {output} {button}"
    click_mode = "button"

    disk "/" {
        format = "/ %avail"
    }

    disk "/home" {
        format = "/home %avail"
    }
}

to my configuration file (I also tried an empty configuration file). An error is reported:

py3status: Setup error (RuntimeError) parse_config.py line 544. Please try to fix this and reload i3wm (Mod+Shift+R)

Without group module or when the group module only contains a single module it works fine.

bug

All 18 comments

Hi @ikzk, that's strange, would you mind showing the result of py3status -v and if possible your entire i3status.conf when it's failing ?

Could you also post the error from the logs. py3status -c <config-path> -l <logfile-path> Thanks

@ultrabug @tobes Sorry for replying late. I am using the py3status-git AUR package for arch linux and I also tried to directly use the master branch (they should be identical actually).

The git log | head shows:

commit c613694b7cb1cef5c7d02dcb8ccd3f37f44b5084
Merge: ef2f535 ac2200f
Author: Ultrabug <[email protected]>
Date:   Thu Aug 4 12:45:44 2016 +0200

    Merge pull request #276 from tobes/sleeping-dogs

    [3.1] Sleeping Dogs: reduce the amount of updating needed especially for containers

The py3status -v shows:

py3status version 3.1rc0 (python 3.5.2)

The i3status.conf is

general {
        colors = true
        interval = 5
}

order += "group disks"

group disks {
    cycle = 30
    format = "Disks: {output} {button}"
    click_mode = "button"

    disk "/" {
        format = "/ %avail"
    }

    disk "/home" {
        format = "/home %avail"
    }
}

The error log is

2016-08-04 14:26:26 WARNING Setup error (RuntimeError) parse_config.py line 544.
2016-08-04 14:26:26 INFO Traceback
RuntimeError: OrderedDict mutated during iteration
  File "/home/alice/.pyenv/versions/anaconda3-4.0.0/lib/python3.5/site-packages/py3status/__init__.py", line 23, in main
    py3.setup()
  File "/home/alice/.pyenv/versions/anaconda3-4.0.0/lib/python3.5/site-packages/py3status/core.py", line 276, in setup
    config = process_config(config_path, self)
  File "/home/alice/.pyenv/versions/anaconda3-4.0.0/lib/python3.5/site-packages/py3status/parse_config.py", line 562, in process_config
    get_modules(config_info)
  File "/home/alice/.pyenv/versions/anaconda3-4.0.0/lib/python3.5/site-packages/py3status/parse_config.py", line 558, in get_modules
    module = process_module(k, v, parent)
  File "/home/alice/.pyenv/versions/anaconda3-4.0.0/lib/python3.5/site-packages/py3status/parse_config.py", line 544, in process_module
    for k, v in module.items():

2016-08-04 14:26:26 ERROR py3status: Setup error (RuntimeError) parse_config.py line 544. Please try to fix this and reload i3wm (Mod+Shift+R)

I checked the module.items(), its value is

odict_items([('cycle', 30), ('format', 'Disks: {output} {button}'), ('click_mode', 'button'), ('disk /', ModuleDefinition([('format', '/ %avail')])), ('disk /home', ModuleDefinition([('format', '/home %avail')]))])⏎ 

I also tried using system's python instead of the anaconda virtualenv, but the error persists:

2016-08-04 14:29:01 WARNING Setup error (RuntimeError) parse_config.py line 544.
2016-08-04 14:29:01 INFO Traceback
RuntimeError: OrderedDict mutated during iteration
  File "/usr/lib/python3.5/site-packages/py3status/__init__.py", line 23, in main
    py3.setup()
  File "/usr/lib/python3.5/site-packages/py3status/core.py", line 276, in setup
    config = process_config(config_path, self)
  File "/usr/lib/python3.5/site-packages/py3status/parse_config.py", line 562, in process_config
    get_modules(config_info)
  File "/usr/lib/python3.5/site-packages/py3status/parse_config.py", line 558, in get_modules
    module = process_module(k, v, parent)
  File "/usr/lib/python3.5/site-packages/py3status/parse_config.py", line 544, in process_module
    for k, v in module.items():

2016-08-04 14:29:01 ERROR py3status: Setup error (RuntimeError) parse_config.py line 544. Please try to fix this and reload i3wm (Mod+Shift+R)

This config works for me.

It is odd that you see module.items() as odict_items(...) I see ModuleDefinition(...) but it is just a subclassed ordered dict. I'm running python 3.4.3 but I wouldn't think 3.5 would behave differently.

The config parser can be run standalone python py3status/parse_config.py <path to config> which might help with debugging.

Does changing line 544 to for k, v in [x for x in module.items()]: fix the issue?

@tobes
It gives the following result:

$ python3 parse_config.py ~/i3status.conf   

PARSING CONFIG FILE /home/alice/downloads/i3status.conf


Traceback (most recent call last):
  File "parse_config.py", line 642, in <module>
    pprint.pprint(process_config(file_name))
  File "parse_config.py", line 562, in process_config
    get_modules(config_info)
  File "parse_config.py", line 558, in get_modules
    module = process_module(k, v, parent)
  File "parse_config.py", line 544, in process_module
    for k, v in module.items():
RuntimeError: OrderedDict mutated during iteration

I'll give python 3.4 a try.

Did you try that possible fix?

@tobes Oh, that's weird.. It works with 3.4.3 on my computer, so the problem might be the inconsistence between python 3.5.2 and 3.4.3..........

@tobes https://github.com/ultrabug/py3status/pull/389 (with 3.5.2) still gives

PARSING CONFIG FILE /home/alice/downloads/i3status.conf


Traceback (most recent call last):
  File "parse_config.py", line 644, in <module>
    pprint.pprint(process_config(file_name))
  File "parse_config.py", line 562, in process_config
    get_modules(config_info)
  File "parse_config.py", line 558, in get_modules
    module = process_module(k, v, parent)
  File "parse_config.py", line 544, in process_module
    for k, v in module.items():
RuntimeError: OrderedDict mutated during iteration

Sorry I meant the [x for x in ...] Fix from my comment a few above. On my
phone so bit hard to type.

I'll try to install 3.5 over the weekend

@tobes Yes changing line 544 to for k, v in [x for x in module.items()]: fixes the issue! Thanks for your help!

Cool I'll make a patch
On 5 Aug 2016 21:30, "界塚 伊奈帆" [email protected] wrote:

@tobes please use just straight list(module.items()) though, not a
list comprehension.

On 08/05/2016 03:31 PM, tobes wrote:

Cool I'll make a patch
On 5 Aug 2016 21:30, "界塚 伊奈帆" [email protected] wrote:

@tobes https://github.com/tobes Yes changing line 544 to for k, v
in [x
for x in module.items()]: fixes the issue! Thanks for your help!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub

https://github.com/ultrabug/py3status/issues/387#issuecomment-237955569,
or mute the thread

https://github.com/notifications/unsubscribe-auth/AADb92y2yZU4sFCX_gdyz-hv93Srhi-6ks5qc51cgaJpZM4JcEUV
.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/ultrabug/py3status/issues/387#issuecomment-237955921,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAghDSWYnJPSOSZJ9Vto27zAeGXZ43I8ks5qc52YgaJpZM4JcEUV.

@pydsigner sure thing

@ikzk if you can confirm that #391 fixes the issue that would be great.

Thanks for reporting these issues. Hope you are enjoying py3status.

@tobes Yes, it works perfectly. Thanks for your work!

Thanks for the report and nice debug guys !

It's merged now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ddurieux picture ddurieux  ·  8Comments

CorruptCommit picture CorruptCommit  ·  5Comments

mxmilkiib picture mxmilkiib  ·  8Comments

ertwro picture ertwro  ·  4Comments

root360-AndreasUlm picture root360-AndreasUlm  ·  5Comments