문제

in py2 there was

rv = xmlrpc.pastes.newPaste(language, code, None, filename, mimetype, private)

I'm getting error : expected an object with the buffer interface

Can't find any docs about xmlrpc and py3. I found only this snippet :

p1 = subprocess.Popen(['gpg','--clearsign'], stdin = subprocess.PIPE, stdout=subprocess.PIPE)
p1.stdin.write(bytes(input, 'UTF8'))
output = p1.communicate()[0]

s = ServerProxy('http://paste.pocoo.org/xmlrpc/')
pasteid = s.pastes.newPaste('text',output.decode())
print ("http://paste.pocoo.org/raw/",pasteid,"/", sep="")

but I'm still being confused about it... my version used many arguments, where can I find full description of it / fix for it ?

Thank you.

도움이 되었습니까?

해결책

That error message usually means it's looking for str (which is Unicode in Python 3), not bytes . Like in the example, you'll need to decode the argument which is in bytes. Maybe:

rv = xmlrpc.pastes.newPaste(language, code.decode(), None, filename, mimetype, private)

But it's hard to tell what the problem is without seeing your code.

다른 팁

In Python 3. xmlrpclib has been split into two modules, xmlrpc.client and xmlrpc.server.

The docs for 3.2.1 can be found at:

http://docs.python.org/release/3.2.1/library/xmlrpc.client.html

http://docs.python.org/release/3.2.1/library/xmlrpc.server.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top