Why Does Inspect.getsource Throw Typeerror When Trying To Get Source For Python Built-in?
What is the difference between a python built-in and a normal object? we often say that in python everything is an object. for example, when I do this in Python 3.6: >>>
Solution 1:
You can't access the source of builtins and other modules that were written using the C API, since there isn't a Python source for them.
From the documentation for os.getsourcefile
Return the name of the Python source file in which an object was defined. This will fail with a TypeError if the object is a built-in module, class, or function.
Post a Comment for "Why Does Inspect.getsource Throw Typeerror When Trying To Get Source For Python Built-in?"