The links in the resources section need updating?
The Python PubSub Samples have been moved to:
I think Google are still maintaining the general Python samples repo, although the repo you have found also contains the Python client and samples specific to Pub/Sub.
Hello Tim, Code has moved and when we try to execute the Publishers.py, it throws error…would be helpful if instructions to execute the new code base is updated please.
python3 schema.py playground-s-11-fc98dbcc create-topic LabTopic my-topic JSON Traceback (most recent call last): File "schema.py", line 479, in
args.project_id, args.topic_id, args.schema_id, args.message_encoding File "schema.py", line 156, in create_topic_with_schema from google.api_core.exceptions import AlreadyExists, InvalidArgument ModuleNotFoundError: No module named ‘google’
Well, did some googling and got it working with the new version of code
Step 1: In the Cloud Console – sudo apt-get update
Step 2: In the Cloud Console – sudo apt-get install virtualenv
Step 3: In the Cloud Console – virtualenv -p python3 venv
Step 4: In the Cloud Console – source venv/bin/activate
Step 5: In the Cloud Console – venv/bin/pip install google-cloud-pubsub
Step 6: In the Cloud Console – git clone https://github.com/googleapis/python-pubsub.git
Step 7: In the Cloud Console – cd python-pubsub/samples/snippets
Step 8: In the Cloud Console – export GLOBAL_CLOUD_PROJECT=
Step 9: In the Cloud Console – python3 publisher.py $GLOBAL_CLOUD_PROJECT create
Step 10: In the Cloud Console – python3 subscriber.py $GLOBAL_CLOUD_PROJECT create