You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use r2pipe in Python 3 and keep running into the error "TypeError: a bytes-like object is required, not 'str'" when using the cmd() function. I have updated r2pipe via pip3, updated r2 to the latest version, and even updated r2pm just in case that would help any. I am running this on a Manjaro Linux machine, though I'm not sure if that would cause any problems. Here is the exact error I am getting:
Traceback (most recent call last):
File "test.py", line 4, in
r2.cmd( 'aa' )
File "/usr/lib/python3.6/site-packages/r2pipe/init.py", line 274, in cmd
res = self._cmd(cmd)
File "/usr/lib/python3.6/site-packages/r2pipe/init.py", line 214, in _cmd_pipe
os.write(self.pipe[1], cmd)
TypeError: a bytes-like object is required, not 'str'
The text was updated successfully, but these errors were encountered:
def _cmd_pipe(self, cmd):
- out = ''
+ out = b''
cmd = cmd.strip().replace("\n", ";")
if os.name == "nt":
windll.kernel32.WriteFile(self.pipe[1], cmd, len(cmd), byref(cbWritten), None)
@@ -137,7 +137,7 @@ class OpenBase(object):
out = out[0:-1]
break
else:
- os.write(self.pipe[1], cmd)
+ os.write(self.pipe[1], cmd.encode())
while True:
res = os.read(self.pipe[0], 4096)
if res[-1] == b'\x00':
It looks like the r2pipe in pypi is the 2.4.0 release of this repo, but the current HEAD version changed a lot. I think you can modify the py files in your installed files.
I'm trying to use r2pipe in Python 3 and keep running into the error "TypeError: a bytes-like object is required, not 'str'" when using the cmd() function. I have updated r2pipe via pip3, updated r2 to the latest version, and even updated r2pm just in case that would help any. I am running this on a Manjaro Linux machine, though I'm not sure if that would cause any problems. Here is the exact error I am getting:
Traceback (most recent call last):
File "test.py", line 4, in
r2.cmd( 'aa' )
File "/usr/lib/python3.6/site-packages/r2pipe/init.py", line 274, in cmd
res = self._cmd(cmd)
File "/usr/lib/python3.6/site-packages/r2pipe/init.py", line 214, in _cmd_pipe
os.write(self.pipe[1], cmd)
TypeError: a bytes-like object is required, not 'str'
The text was updated successfully, but these errors were encountered: