GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Pubsub example on front page fails if topic does not already exist · Issue #1082 · googleapis/google-cloud-python

Pubsub example on front page fails if topic does not already exist #1082

New issue
Copy link
New issue
Copy link
Closed
Closed
Pubsub example on front page fails if topic does not already exist#1082
Copy link
Assignees
dhermes
Labels
api: pubsubIssues related to the Pub/Sub API.

Description

@Michael0x2a
Michael0x2a
opened on Aug 24, 2015
Issue body actions

The pubsub example throws an exception if the specified topic does not already exist. Example:

>>> from gcloud import pubsub
>>> client = pubsub.Client(project=MY_PROJECT_ID)
>>> topic = client.topic('my-new-custom-topic')
>>> topic.publish('Ping!')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/gcloud/pubsub/topic.py", line 186, in publish
    method='POST', path='%s:publish' % (self.path,), data=data)
  File "/usr/local/lib/python2.7/dist-packages/gcloud/connection.py", line 419, in api_request
    error_info=method + ' ' + url)
gcloud.exceptions.NotFound: 404 Resource not found (resource=my-custom-topic). (POST https://pubsub.googleapis.com/v1/projects/lee-cloud/topics/my-custom-topic:publish)

The code sample will resume working if you create the topic and re-run the sample, but it would be nice if the code sample included a line or two demonstrating how to create a topic if it doesn't exist.

Activity

  1. dhermes commented on Aug 24, 2015

    @dhermes
    dhermes
    on Aug 24, 2015
    Contributor
    More actions

    What page is this from?

  2. Michael0x2a commented on Aug 24, 2015

    @Michael0x2a
    Michael0x2a
    on Aug 24, 2015
    Author
    More actions

    Whoops, sorry -- at the bottom of https://cloud.google.com/python/ if you click "Publish messages and subscribe to Pub/Sub topics".

  3. theacodes commented on Aug 24, 2015

    @theacodes
    theacodes
    on Aug 24, 2015
    Contributor
    More actions

    Assign this to me, Danny. I guess we need to call out specifically that
    users should create their topic beforehand.

    (fwiw, I don't like these samples on the python landing page...)

    On Mon, Aug 24, 2015 at 4:00 PM Michael Lee [email protected]
    wrote:

    Whoops, sorry -- at the bottom of https://cloud.google.com/python/ if you
    click "Publish messages and subscribe to Pub/Sub topics".

    —
    Reply to this email directly or view it on GitHub
    #1082 (comment)
    .

  4. dhermes commented on Aug 24, 2015

    @dhermes
    dhermes
    on Aug 24, 2015
    Contributor
    More actions

    /cc @jonparrott

    UPDATE: Jinx!

  5. dhermes commented on Aug 24, 2015

    @dhermes
    dhermes
    on Aug 24, 2015
    Contributor
    More actions

    @jonparrott I can't assign to someone outside the org. Are you not a part of GoogleCloudPlatform? If not, why not?

  6. theacodes commented on Aug 24, 2015

    @theacodes
    theacodes
    on Aug 24, 2015
    Contributor
    More actions

    I am, but our repos are divided into teams. I'm not part of the team that's
    on this repo (perhaps I should be?)

    On Mon, Aug 24, 2015 at 4:02 PM Danny Hermes [email protected]
    wrote:

    @jonparrott https://github.com/jonparrott I can't assign to someone
    outside the org. Are you not a part of GoogleCloudPlatform? If not, why not?

    —
    Reply to this email directly or view it on GitHub
    #1082 (comment)
    .

  7. dhermes commented on Aug 24, 2015

    @dhermes
    dhermes
    on Aug 24, 2015
    Contributor
    More actions

    What are the implications? We can chat on Hangouts if it's easier / less public.

  8. theacodes commented on Aug 24, 2015

    @theacodes
    theacodes
    on Aug 24, 2015
    Contributor
    More actions

    Nothing that I'm aware of. Summoning @elibixby who has admin rights to GoogleCloudPlatform.

  9. elibixby commented on Aug 25, 2015

    @elibixby
    elibixby
    on Aug 25, 2015
    More actions

    Unfortunately right a team has a level of permissions, a set of repos and a set of members, and everyone on the team has the same level of permissions for all the repos of the team.... It's a really bad permissions model, and we're moving to the new one Sept 22nd, until then, make your team choice accordingly =)

  10. theacodes commented on Aug 25, 2015

    @theacodes
    theacodes
    on Aug 25, 2015
    Contributor
    More actions

    I'm tracking this via an internal bug now, as it's unclear whether we should instruct new users to create projects, enable billing, etc, or just remove these code samples.

  11. dhermes commented on Aug 25, 2015

    @dhermes
    dhermes
    on Aug 25, 2015
    Contributor
    More actions

    Shall I close this issue?

  12. theacodes commented on Aug 25, 2015

    @theacodes
    theacodes
    on Aug 25, 2015
    Contributor
    More actions

    Sure - it's not an issue with this library.

  13. dhermes
    closed this as completedon Aug 25, 2015
  14. dhermes
    added
    api: pubsubIssues related to the Pub/Sub API.
    on Dec 31, 2015
  15. JustinBeckwith
    assigned
    dhermes
    on Feb 1, 2021
  16. parthea
    added a commit that references this issue on Nov 24, 2025

    chore(deps): update dependency jinja2 to v3.0.3 (#1082)

    c94057c
  17. parthea
    added 3 commits that reference this issue on Mar 2, 2026

    build(deps): bump cryptography from 42.0.0 to 42.0.2 in .kokoro (#1082)

    12ee53f

    chore: update python-docs-samples link to main branch (#1082)

    3a8adae

    feat: add support for custom headers (#1121)

    527ef39
  18. parthea
    added a commit that references this issue on Sep 8, 2026

    docs: migrate code from googleapis/python-bigquery (#18303)

    23f9a74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dhermes
    dhermes

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.