简体   繁体   English

GZIP python3 AttributeError:“模块”对象没有属性“压缩”

[英]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.

相关问题 Django Python3-AttributeError:“模块”对象没有属性“ META” - Django Python3 - AttributeError: 'module' object has no attribute 'META' Python3(anaconda)中的tkinter,“ AttributeError:模块'tkinter'没有属性'Tk'” - tkinter in Python3 (anaconda), “AttributeError: module 'tkinter' has no attribute 'Tk'” AttributeError:模块'selenium.webdriver'没有属性'Chrome'Python3 - AttributeError: module 'selenium.webdriver' has no attribute 'Chrome' Python3 Python3 错误:AttributeError:模块 'urllib' 没有属性 'request' - Python3 error : AttributeError: module 'urllib' has no attribute 'request' Python AttributeError:“模块”对象没有属性“ Goslate” - Python AttributeError: 'module' object has no attribute 'Goslate' python 3 mac:snappy.compress AttributeError:模块“snappy”没有属性“compress” - python 3 mac: snappy.compress AttributeError: module 'snappy' has no attribute 'compress' Python3六-AttributeError:自定义对象没有属性“ items” - Python3 six - AttributeError: custom object has no attribute 'items' AttributeError:'NoneType'对象没有属性'text'python3 +代理 - AttributeError: 'NoneType' object has no attribute 'text' python3 + proxy AttributeError: 'NoneType' object 没有属性 'lower' Python3 - AttributeError: 'NoneType' object has no attribute 'lower' Python3 使用 Python3 / AttributeError 抓取网站:'NoneType' object 没有属性 'text' - Scraping website with Python3 / AttributeError: 'NoneType' object has no attribute 'text'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM