SUSE/cpuset

cset set might fail with TypeError: unsupported operand type(s) for //: 'str' and 'int'

Closed this issue · 3 comments

Running 'cset set' might result in:

bash-4.4# cset set
Traceback (most recent call last):
  File "/usr/bin/cset", line 47, in <module>
    main()
  File "/usr/lib/python3.6/site-packages/cpuset/main.py", line 234, in main
    command.func(parser, options, args)
  File "/usr/lib/python3.6/site-packages/cpuset/commands/set.py", line 212, in func
    else: list_sets('root', options.recurse, options.usehex)
  File "/usr/lib/python3.6/site-packages/cpuset/commands/set.py", line 243, in list_sets
    pl.append(set_details(s,' ', 78, usehex))
  File "/usr/lib/python3.6/site-packages/cpuset/commands/set.py", line 487, in set_details
    pathb = set.path[len(set.path//2):]
TypeError: unsupported operand type(s) for //: 'str' and 'int'

Should the code in set.py be updated like:

- pathb = set.path[len(set.path//2):]
+pathb = set.path[len(set.path)//2:]

?

The issue happens for me when running
cset set -r

updating set.py as mentioned above fixes the issue.

Hi. I'm having the same issue. 'cpuset' was installed from Arch's AUR repository with 'yay'. Should I manually change the source myself as suggested?

Traceback (most recent call last):
  File "/usr/bin/cset", line 47, in <module>
    main()
  File "/usr/lib/python3.11/site-packages/cpuset/main.py", line 234, in main
    command.func(parser, options, args)
  File "/usr/lib/python3.11/site-packages/cpuset/commands/set.py", line 186, in func
    else: list_sets('root', options.recurse, options.usehex)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cpuset/commands/set.py", line 243, in list_sets
    pl.append(set_details(s,' ', 78, usehex))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cpuset/commands/set.py", line 487, in set_details
    pathb = set.path[len(set.path//2):]
                         ~~~~~~~~^^~
TypeError: unsupported operand type(s) for //: 'str' and 'int'
$ sudo cset -v 
$ cset: Cpuset (cset) 1.6
Werkov commented

Thanks for the reminder.
That's looks like a typo and it has been fixed in the commit a4b6b27 -- included in v1.6.1, so downstreams can bump their versions.
Closing.