and calling something() inside the ghidra's pyhidra window
>>> import logme
>>> logme.something()
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.10/logging/__init__.py", line 1103, in emit
stream.write(msg + self.terminator)
OSError: [Errno 9] Bad file descriptor
Call stack:
File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.10/code.py", line 232, in interact
more = self.push(line)
File "/usr/lib/python3.10/code.py", line 258, in push
more = self.runsource(source, self.filename)
File "/usr/lib/python3.10/code.py", line 74, in runsource
self.runcode(code)
File "/opt/symbolic/.venv/lib/python3.10/site-packages/pyhidra/java/plugin/plugin.py", line 163, in runcode
super().runcode(code)
File "/usr/lib/python3.10/code.py", line 90, in runcode
exec(code, self.locals)
File "<console>", line 1, in <module>
File "/opt/symbolic/logme.py", line 10, in something
logger.info("miao")
Message: 'miao'
Arguments: ()
where in a normal execution inside a normal python intepreter you have
In [1]: import logme
In [2]: logme.something()
In [3]:
and then
$ cat /tmp/ghidra_abstract.log
INFO 2022-12-24 12:51:37,032 - miao
This is probably caused by a closed stdout: still inside pyhidra terminal you can generate the same error
>>> os.write(1, b"miao")
Traceback (most recent call last):
File "<console>", line 1, in <module>
OSError: [Errno 9] Bad file descriptor
Thanks for letting us know about this issue. For the time being when you use logging.basicConfig in your script setting force=True should allow working around this issue.
Using the logging module inside
pyhidra
generates exceptions: with a simple test script like the following (namedlogme.py
)and calling
something()
inside theghidra
'spyhidra
windowwhere in a normal execution inside a normal python intepreter you have
and then
This is probably caused by a closed stdout: still inside
pyhidra
terminal you can generate the same error