1

according to https://docs.python.org/3/library/gzip.html creating a compressed gzip file requires the following:

import gzip
content = b"Lots of content here"
with gzip.open('/home/joe/file.txt.gz', 'wb') as f:
    f.write(content)

However, when I run the code, I get the following error using python 3 AttributeError: module 'gzip' has no attribute 'open'

not sure what is happening....

1 Answer 1

4

You've called something else gzip.py, which is shadowing the standard library module. Rename it and any compiled files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.