Message403410
When you exec inspect.getouterframes() in directory, which no longer exists, then you get traceback, because the code traverse to os.getcwd() which fails.
Reproducer:
$ mkdir /tmp/bar
$ cd /tmp/bar
$ rmdir /tmp/bar
$ python3
Python 3.10.0rc2 (default, Sep 8 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> inspect.getouterframes(inspect.currentframe())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.10/inspect.py", line 1653, in getouterframes
frameinfo = (frame,) + getframeinfo(frame, context)
File "/usr/lib64/python3.10/inspect.py", line 1623, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "/usr/lib64/python3.10/inspect.py", line 829, in getsourcefile
module = getmodule(object, filename)
File "/usr/lib64/python3.10/inspect.py", line 861, in getmodule
file = getabsfile(object, _filename)
File "/usr/lib64/python3.10/inspect.py", line 845, in getabsfile
return os.path.normcase(os.path.abspath(_filename))
File "/usr/lib64/python3.10/posixpath.py", line 383, in abspath
cwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory |
|
Date |
User |
Action |
Args |
2021-10-07 13:57:49 | msuchy@redhat.com | set | recipients:
+ msuchy@redhat.com |
2021-10-07 13:57:49 | msuchy@redhat.com | set | messageid: <1633615069.33.0.311671101448.issue45406@roundup.psfhosted.org> |
2021-10-07 13:57:49 | msuchy@redhat.com | link | issue45406 messages |
2021-10-07 13:57:49 | msuchy@redhat.com | create | |
|