Skip to content

Instantly share code, notes, and snippets.

@gsoykan
Created July 14, 2023 11:29
Show Gist options
  • Select an option

  • Save gsoykan/bebf700b52a001938d088e03c7c83200 to your computer and use it in GitHub Desktop.

Select an option

Save gsoykan/bebf700b52a001938d088e03c7c83200 to your computer and use it in GitHub Desktop.
checks a python package source -> really useful when package errors happen
import inspect
import ssl # Replace with the name of the imported package you want to check
def get_package_source(package):
module = inspect.getmodule(package)
if module is not None:
source_file = inspect.getfile(module)
print(f"Source location for package '{package.__name__}': {source_file}")
else:
print(f"Package '{package.__name__}' is not found.")
get_package_source(ssl) # Replace with the imported package you want to check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment