python 2.7 - google cloud library not working ( ImportError) -


i trying use cloud pub/sub pull message data topic keep getting importerror every time stating

importerror: dynamic module not define init function (init_psutil_linux) 

this environment info:

  • app engine standard environment
  • python2.7

this code:

import logging import json # datetime import datetime, timedelta import time  # imports google cloud client library google.cloud import pubsub_v1  import webapp2   class pullmessagedata(webapp2.requesthandler):     """pull pub/sub message data."""      def get(self):         self.response.headers['content-type'] = 'application/json'          try:             subscriber_name = 'subscriber_name'              # pull subscription message             pull_message_data(subscriber_name)             self.response.write(json.dumps({'status': 'ok'}))          except exception, e:             logging.exception(str(e))             self.response.write(json.dumps({'status': 'error'}))   def pull_message_data(subscriber_name):     """pull message data pubsub."""      # instantiate pubsub client default credential     subscriber = pubsub_v1.subscriberclient()      # callback function processing message data     def callback(message):                     # process data         print('received message: {}'.format(message.data))          # ack message after processing         message.ack()      # limit subscriber have 5000 outstanding messages @ time.     flow_control = pubsub_v1.types.flowcontrol(max_messages=3)     # pull message     subscriber.subscribe(         subscriber_name, callback=callback, flow_control=flow_control)      # subscriber non-blocking, must keep main thread     # exiting allow process messages in background.     print('listening messages on {}'.format(subscriber_name))     while true:         time.sleep(10) 

i followed documentation the google cloud pubsub documentation page after deployed kept getting importerror says this:

(/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py:263) traceback (most recent call last):   file "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in handle     handler = _config_handle.add_wsgi_middleware(self._loadhandler())   file "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 299, in _loadhandler     handler, path, err = loadobject(self._handler)   file "/base/data/home/runtimes/python27_experiment/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 85, in loadobject     obj = __import__(path[0])   file "/base/data/home/apps/b~ups/1.404014226174083542/main.py", line 4, in <module>     import pull_data   file "/base/data/home/apps/b~ups/1.404014226174083542/pull_data.py", line 9, in <module>     google.cloud import pubsub_v1   file "/base/data/home/apps/b~ups/1.404014226174083542/libs/google/cloud/pubsub_v1/__init__.py", line 17, in <module>     google.cloud.pubsub_v1 import types   file "/base/data/home/apps/b~ups/1.404014226174083542/libs/google/cloud/pubsub_v1/types.py", line 20, in <module>     import psutil   file "/base/data/home/apps/b~ups/1.404014226174083542/libs/psutil/__init__.py", line 91, in <module>     . import _pslinux _psplatform   file "/base/data/home/apps/b~ups/1.404014226174083542/libs/psutil/_pslinux.py", line 26, in <module>     . import _psutil_linux cext importerror: dynamic module not define init function (init_psutil_linux) 

this calling file from:

import os import webapp2 import pull_data   app = webapp2.wsgiapplication([     ('/pull', pull_data.pullmessagedata), ], debug=true) 

please can figure wrong.....


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -