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
then it raises TypeError: initial_value must be str or None, not bytes like this:
Traceback (most recent call last):
File "/home/wonseok/current/pwntools/my_test.py", line 7, in <module>
c = CorefileFinder(p)
File "/home/wonseok/current/pwntools/pwnlib/elf/corefile.py", line 1197, in __init__
self.core_path = self.native_corefile()
File "/home/wonseok/current/pwntools/pwnlib/elf/corefile.py", line 1372, in native_corefile
return self.native_corefile_pipe()
File "/home/wonseok/current/pwntools/pwnlib/elf/corefile.py", line 1390, in native_corefile_pipe
apport_core = self.apport_corefile()
File "/home/wonseok/current/pwntools/pwnlib/elf/corefile.py", line 1262, in apport_corefile
return self.apport_crash_extract_corefile(crash_data)
File "/home/wonseok/current/pwntools/pwnlib/elf/corefile.py", line 1273, in apport_crash_extract_corefile
file = StringIO(crashfile_data)
TypeError: initial_value must be str or None, not bytes
log.debug("Looking for Apport crash at %r"%crash_path)
data=self.read(crash_path)
exceptException:
returnNone
# Remove the crash file, so that future crashes will be captured
try:
self.unlink(crash_path)
exceptException:
pass
returndata
The cause is that apport_read_crash_data method returns bytes because self.read at line 1322 can return bytes instead of str.
I think that type casting can be solution before return statement.
If I missed something, please let me know.
Thank you.
The text was updated successfully, but these errors were encountered:
Create
test.py
like:then it raises
TypeError: initial_value must be str or None, not bytes
like this:pwntools/pwnlib/elf/corefile.py
Lines 1309 to 1332 in 5981c72
The cause is that
apport_read_crash_data
method returns bytes becauseself.read
at line 1322 can return bytes instead of str.I think that type casting can be solution before return statement.
If I missed something, please let me know.
Thank you.
The text was updated successfully, but these errors were encountered: