Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
przemekr opened this issue Nov 24, 2020 · 3 comments

Comments

@przemekr
Copy link

przemekr commented Nov 24, 2020

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:]

?

@meetesh06
Copy link

The issue happens for me when running
cset set -r

updating set.py as mentioned above fixes the issue.

@MarkGotLasagna
Copy link

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
Copy link
Member

Werkov commented Sep 27, 2023

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.

@Werkov Werkov closed this as completed Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants