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

TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str. #1169

Open
glandium opened this issue Dec 26, 2023 · 2 comments

Comments

@glandium
Copy link
Contributor

Running the delete command with the client fails with this error:

Traceback (most recent call last):
  File "/tmp/tooltool/client/tooltool.py", line 1713, in <module>
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/tmp/tooltool/client/tooltool.py", line 1709, in main
    return 0 if process_command(options, args) else 1
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tooltool/client/tooltool.py", line 1540, in process_command
    return delete_instances(
           ^^^^^^^^^^^^^^^^^
  File "/tmp/tooltool/client/tooltool.py", line 1473, in delete_instances
    return send_operation_on_file(data, base_urls, digest, auth_file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tooltool/client/tooltool.py", line 1450, in send_operation_on_file
    urllib2.urlopen(req)
  File "/usr/lib/python3.11/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/urllib/request.py", line 516, in open
    req = meth(req)
          ^^^^^^^^^
  File "/usr/lib/python3.11/urllib/request.py", line 1279, in do_request_
    raise TypeError(msg)

That being said, even with that fixed up, delete doesn't seem to work.

@jcristau
Copy link
Contributor

That being said, even with that fixed up, delete doesn't seem to work.

Can you clarify on that part, what you tried to delete and what the outcome was?

Thanks!

@glandium
Copy link
Contributor Author

glandium commented Jan 9, 2024

I was trying to delete something that, it turns out, was just in a weird state, and I don't need to delete anymore (on the contrary, I need it there now). The weird state might have been the reason for the failure, but I don't have something else to delete to try.

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

2 participants