def main():
print('Hello world!')
if __name__ == '__main__':
def main()
helloworld/__init__.py
In this example, __init__.py is empty.
pyminifier Command Example
$ pyminifier --lzma hello-world/*
hello-world/hello-world.py (81) reduced to 300 bytes (370.37% of original size)
Traceback (most recent call last):
File "/home/eric/miniconda3/envs/r-net-obs/bin/pyminifier", line 11, in <module>
sys.exit(main())
File "/home/eric/miniconda3/envs/r-net-obs/lib/python3.6/site-packages/pyminifier/pyminifier.py", line 383, in main
(float(new_filesize) / float(filesize)) * 100, 2)
ZeroDivisionError: float division by zero
import lzma, base64
exec(lzma.decompress(base64.b64decode('/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4ABHAEFdADIZSP9PQ8pBqvy8GuB3/\
H0Qt1jd2RFpjIH9/RzFxpUPhuyY1j8kvGaXMaA/+973nHhS7q96s0/enRActGVVWm9CAAAAACfiBV7GVo8JAAFdSJBflFcftvN9A\
QAAAAAEWVo=')))
# Created by pyminifier (https://github.com/liftoff/pyminifier)
minified/__init__.py
File Edit Options Buffers Tools Python Help
import lzma, base64
exec(lzma.decompress(base64.b64decode('/Td6WFoAAATm1rRGAAAAABzfRCEftvN9AQAAAAAEWVo=')))
# Created by pyminifier (https://github.com/liftoff/pyminifier)
Explanation
You can see from the example that pyminifier successfully does it job, but when it tries to report the % reduction in size (after the fact), it gets a ZeroDivisionError
When
pyminifier
is run on multiple files and at least one of those files is empty, for example a simple__init__.py
,pyminifier
returns an error.Setup To Reproduce
File Structure
helloworld/helloworld.py
helloworld/__init__.py
In this example,
__init__.py
is empty.pyminifier
Command ExampleCommand Output
File Structure
minified/helloworld.py
minified/__init__.py
Explanation
You can see from the example that
pyminifier
successfully does it job, but when it tries to report the % reduction in size (after the fact), it gets aZeroDivisionError