cpuset icon indicating copy to clipboard operation
cpuset copied to clipboard

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

Open przemekr opened this issue 5 years ago • 1 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:]

?

przemekr avatar Nov 24 '20 10:11 przemekr

The issue happens for me when running cset set -r

updating set.py as mentioned above fixes the issue.

meetesh06 avatar Aug 22 '22 08:08 meetesh06

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

MarkGotLasagna avatar Sep 27 '23 05:09 MarkGotLasagna

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

Werkov avatar Sep 27 '23 09:09 Werkov