Reputation: 3595
I launched a new Google Cloud Workstation and create a single python file with these contents:
import bz2
import binascii
original_data = 'This is the original text.'
print ('Original :', len(original_data), original_data)
compressed = bz2.compress(original_data)
print ('Compressed :', len(compressed), binascii.hexlify(compressed))
decompressed = bz2.decompress(compressed)
print ('Decompressed :', len(decompressed), decompressed)
When I tried to run this code I received this error:
Traceback (most recent call last):
File "/home/user/01/app.py", line 1, in <module>
import bz2
File "/usr/local/lib/python3.10/bz2.py", line 17, in <module>
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
What am I doing wrong?
Upvotes: 0
Views: 37