This is probably happening due to Python package conflicts. By default,
when you do "import google" it finds the first "google" package in your
PYTHONPATH. It does *not* combine all the separate "google" packages
together. There is a way to "opt in" to combining packages, but the App
Engine packages and some of Google's other old Python packages don't do it,
so you can run into this. We've hacked around this by adding a file named:

${VIRTUALENV}/lib/python2.7/site-packages/gae.pth


With the following contents:

${YOUR PATH TO google-cloud-sdk/platform/google_appengine}
import dev_appserver; dev_appserver.fix_sys_path()
import google
import pkgutil; pkgutil.extend_path(google.__path__, google.__name__)


This gets loaded by Python before anything else, and ensures that the
multiple "google" packages you might have get combined together. There are
probably other ways to hack around this, but the key line is inserting
pkgutil.extend_path(google.__path__,
google.__name__) somewhere in your code. Good luck!




On Tue, Feb 14, 2017 at 2:37 AM, Sumanau Sareen <sumanausare...@gmail.com>
wrote:

>
> I am using the same approach.
>
> The issue is only visible for bigquery library in appengine sandbox. In
> production everything is working fine.
>
> where as if i try to use from gcloud import bigquery
>
> it fails with error:
>
>   File 
> "/home/user/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py",
>  line 1001, in load_module
>     raise ImportError('No module named %s' % fullname)
> ImportError: No module named google.protobuf
>
> where protobuf is also installed.
>
> Other then these libraries, all other libraries are working fine.
>
> On Monday, February 13, 2017 at 7:13:52 PM UTC+5:30, Attila-Mihaly Balazs
> wrote:
>>
>> An alternative to the PYTHONPATH solution is the following:
>>
>> - create an "appengine_config.py" in the same directory you have your
>> app.yaml
>> - put the following into it:
>>
>> from google.appengine.ext import vendor
>> vendor.add('lib')
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google App Engine" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/google-appengine/C5LjgIiJwJY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at https://groups.google.com/group/google-appengine.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-appengine/cd0067ba-e94b-4642-9133-
> d96ae2ab1483%40googlegroups.com
> <https://groups.google.com/d/msgid/google-appengine/cd0067ba-e94b-4642-9133-d96ae2ab1483%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CACRPLjjhnt%3DPMTtuu5kc23RkyE7RLZf2V36mrQiDv2SMm7utXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to