[英]GZIP python3 AttributeError: 'module' object has no attribute 'compress'
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. 我正在尝试在EC2实例上使用gzip python lib压缩文件。 I assume that gzip is part of the standard library.
我认为gzip是标准库的一部分。 However, I get the following error
但是,出现以下错误
AttributeError: 'module' object has no attribute 'compress'
I figured out that someone else had added a library called gzip. 我发现其他人添加了一个名为gzip的库。 So, it was defaulting to that one and the not standard library.
因此,它默认为该库,而不是标准库。 I ended up using zlib instead.
我最终改为使用zlib。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.