EmptyFiles

raw JSON →
0.0.9 verified Mon Apr 27 auth: no python

Provides empty (placeholder) files in many formats (images, documents, archives, etc.) for testing and development. Current version 0.0.9, active development on GitHub.

pip install empty-files
error AttributeError: module 'empty_files' has no attribute 'empty_files'
cause Using `import empty_files` then trying `empty_files('png')` without qualifying the module.
fix
Use from empty_files import empty_files and then empty_files('png').
error requests.exceptions.SSLError: HTTPSConnectionPool(host='...', port=443): Max retries exceeded with url: /... (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed')))
cause The library attempts to fetch placeholder definitions from a remote URL (GitHub). On Python 3.7 with misconfigured OpenSSL, this fails and falls back to zero-byte files.
fix
Set environment variable SSL_CERT_FILE to a valid CA bundle, or upgrade Python to 3.8+.
gotcha On Python 3.7, if OpenSSL is not configured correctly for urllib3, the library silently falls back to writing 0-byte files instead of proper placeholders. Always verify the content length > 0 if using placeholder integrity.
fix Upgrade Python to 3.8+ or set SSL_CERT_FILE environment variable. Alternatively, check returned bytes length.
gotcha The function name `empty_files` is also the module name. If you do `import empty_files`, you must call `empty_files.empty_files()` or alias it. Many new users forget the module prefix.
fix Use `from empty_files import empty_files` and then call `empty_files('pdf')`.
deprecated Python 3.6 support was dropped in v0.0.4. Installing on 3.6 will get an older, unmaintained version.
fix Upgrade to Python 3.7+.

Fetch empty file bytes for any supported extension. See AllEmptyFiles().ALL_FILES for full list.

from empty_files import empty_files

# Get empty PNG file content (bytes)
png_bytes = empty_files('png')
print(f'Got {len(png_bytes)} bytes of empty PNG')

# Get all supported extensions
from empty_files import AllEmptyFiles
extensions = list(AllEmptyFiles().ALL_FILES.keys())
print(extensions[:5])