pipe.setnx(prefix+item[0], gzip.compress(bytes(item[1], 'utf-8')))
I'm trying to compress a file using the gzip python lib on an EC2 instance. I assume that gzip is part of the standard library. However, I get the following error
我正在尝试使用EC2实例上的gzip python lib压缩文件。我假设gzip是标准库的一部分。但是,我收到以下错误
AttributeError: 'module' object has no attribute 'compress'
1 个解决方案
#1
0
I figured out that someone else had added a library called gzip. So, it was defaulting to that one and the not standard library. I ended up using zlib instead.
我发现其他人已经添加了一个名为gzip的库。因此,它违反了那个和非标准库。我最终使用zlib。
#1
0
I figured out that someone else had added a library called gzip. So, it was defaulting to that one and the not standard library. I ended up using zlib instead.
我发现其他人已经添加了一个名为gzip的库。因此,它违反了那个和非标准库。我最终使用zlib。