liftoff / pyminifier

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

TypeError: obfuscation_machine() got an unexpected keyword argument 'count' #80

Open bertoneone opened 7 years ago

bertoneone commented 7 years ago

I had this very easy issue when using the following command: pyminifier --obfuscate --pyz=test.pyz test.py

Traceback (most recent call last): File "/usr/local/bin/pyminifier", line 11, in load_entry_point('pyminifier==2.1', 'console_scripts', 'pyminifier')() File "/usr/local/lib/python3.5/dist-packages/pyminifier/pyminifier.py", line 302, in main compression.zip_pack(pyz_file, options) File "/usr/local/lib/python3.5/dist-packages/pyminifier/compression.py", line 222, in zip_pack use_unicode=True, count=identifier_length TypeError: obfuscation_machine() got an unexpected keyword argument 'count'

The fix is straightforward, I already tested it on my side. In the file pyminifier/compression.py on line 230 just substitute: count=identifier_length with: identifier_length=identifier_length

Probably the keyword argument name was not changed everywhere.

Hope this helps!

tcco commented 7 years ago

Along with pyz flag, when I use --outfile I encounter

pwd/pyminifier/pyminifier.py", line 423, in main f = open(options.outfile, 'w', encoding='utf-8') TypeError: 'encoding' is an invalid keyword argument for this function

I believe this may of be some help

http://stackoverflow.com/questions/25049962/is-encoding-is-an-invalid-keyword-error-inevitable-in-python-2-x

sunapi386 commented 6 years ago

This is fixed in version 2.2.

sunapi386 commented 6 years ago

pip install git+git://github.com/liftoff/pyminifier.git@master to get the latest version.

jlstanley-git commented 6 years ago

There is also a similar reference to a "count" argument on line 222 in the same file (compression.py). Same fix, replace "count" with "identifier_length" and you're good to go.