1

I'm running Python 2.7.14, Windows machine and I've been trying to see up a simple pubsub sample using the Google Cloud Python library to get it all to work, but for some reason, none of the examples I've tried actually work. The script I've got is:

from google.cloud import pubsub_v1 as pubsub
c = pubsub.SubscriberClient()
t = c.topic_path('topic_project', 'topic_name')
s = c.subscription_path('subscription_project', 'subscription_path')
c.create_subscription(s,t)

This should create a subscription, but I get E1101:Instance of 'SubscriberClient' has no 'create_subscription' member so it's unable to do that. I've tried the official examples from the documentation, and other stackoverflow examples, and none of them have actually worked.

I've already uninstalled all my pip packages, and reinstalled using pip install --upgrade google-cloud-pubsub as per https://cloud.google.com/pubsub/docs/reference/libraries#client-libraries-install-python but still nothing. This is my pip freeze:

astroid==1.6.5
backports.functools-lru-cache==1.5
cachetools==2.1.0
certifi==2018.10.15
chardet==3.0.4
colorama==0.4.0
configparser==3.5.0
enum34==1.1.6
futures==3.2.0
google-api-core==1.5.0
google-auth==1.5.1
google-cloud-pubsub==0.38.0
googleapis-common-protos==1.5.3
grpc-google-iam-v1==0.11.4
grpcio==1.15.0
idna==2.7
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
protobuf==3.6.1
pyasn1==0.4.4
pyasn1-modules==0.2.2
pylint==1.9.3
pytz==2018.5
requests==2.20.0
rsa==4.0
singledispatch==3.4.0.3
six==1.11.0
urllib3==1.24
wrapt==1.10.11

Does anyone have any ideas on what else I can look into to get these examples to run?

Thanks!

Jinjun
  • 381
  • 2
  • 11
  • If you run `python -m pip freeze`, is the version of `google-cloud-pubsub` also `0.38.0`? – Dustin Ingram Oct 22 '18 at 00:33
  • Also, is this error from PyLint, or does it happen when you run the script? – Dustin Ingram Oct 22 '18 at 00:35
  • Please [edit] your question title to something that describes the problem you're having or question you're asking. Simply repeating the tags is not useful. Your title should be clear enough to be of use to future readers here who are scanning a list of search results trying to find a solution to a problem. Thanks. – Ken White Oct 22 '18 at 01:06
  • `python -m pip freeze` returns `google-cloud-pubsub==0.38.0` as well, and the script does work when I just run it, so it means hat Pylint was giving me issues. Is there any reason why Pylint would be throwing an error when it shouldn't? – Ciaran Blewitt Oct 22 '18 at 03:14

0 Answers0