liftoff / pyminifier

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

Pattern ./*.py not work #45

Closed xzzh999 closed 5 years ago

xzzh999 commented 9 years ago

Hi,bigcow,you're done a great work,and i found a problem here when use follow cmd on Win7 64:

           pyminifier -d /temp -O --replacement-length=5 --obfuscate-builtins   .\*.py

and here is the Traceback:

           Traceback (most recent call last):
           File "C:\Python27\Scripts\pyminifier-script.py", line 9, in <module>
           load_entry_point('pyminifier==2.1', 'console_scripts', 'pyminifier')()
           File "C:\Python27\lib\site-packages\pyminifier\pyminifier.py", line 392, in main
           filesize = os.path.getsize(args[0])
           File "C:\Python27\lib\genericpath.py", line 49, in getsize   return os.stat(filename).st_size
           WindowsError: [Error 123] : '.\\*.py'

Seems can't recognize the '.*.py', can you give some help, thank you very much!

liftoff commented 9 years ago

You have a file named (literally) '.*.py' ? Does this work?

pyminifier -d /temp -O --replacement-length=5 --obfuscate-builtins   */*.py

I think that even though you're in Windows it should know how to parse a Unixy path like that.

xzzh999 commented 9 years ago

Thank you for your reply, my writting mistake, i tried ".*.py" and it show the error above.

xzzh999 commented 9 years ago

And yes, i think i can parse .py myself to get a list of files instead of using .py if pyminifier doesn't surpport it.

sayak-brm commented 8 years ago

Apparently, Wildcards -as shown in the docs- are not being supported on Windows.

Example: pyminifier -d "C:\Users\admin\Desktop\Projects\Python 3.5.1\sysAuth\New" "C:\Users\user\Desktop\Projects\abc\xyz\*.py" gives error OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\user\\Desktop\\Projects\\abc\\xyz\\*.py'

However, when a definite filename in the directory is give, like "C:\Users\user\Desktop\Projects\abc\xyz\helloWorld.py", PyMinifier works perfectly.

This is not a problem with Linux, but for compatibility, I think a different method for going through directories should be used.

xzzh999 commented 5 years ago

idle for too long time, close it.