liftoff / pyminifier

Pyminifier is a Python code minifier, obfuscator, and compressor.
GNU General Public License v3.0
1.46k stars 223 forks source link

Not creating result file incase subfolder contains only one file #50

Closed sejans closed 8 years ago

sejans commented 8 years ago

Here is line that should obfuscate all .py files in folder orig and write result into folder obf

pyminifier -O -d obf orig/*.py

It works incase orig folder contains at least two files, however, if orig contains only one .py file, then the result is writtent to console and nothing is created in obf.


Also errors appear incase orig doesnt contain any .py file at all.

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.4/bin/pyminifier", line 9, in load_entry_point('pyminifier==2.1', 'console_scripts', 'pyminifier')() File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pyminifier/pyminifier.py", line 393, in main filesize = os.path.getsize(args[0]) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/genericpath.py", line 50, in getsize return os.stat(filename).st_size FileNotFoundError: [Errno 2] No such file or directory: 'orig/*.py'

Because the script is run on many subfolders it would be good to remove this error in case there are no .py files in path

sejans commented 8 years ago

Both problems are fixed