Problems uploading images from GAE app using gcloud library.

54 views
Skip to first unread message

Juan Antonio Fernández Sánchez

unread,
Mar 29, 2016, 6:54:57 AM3/29/16
to Google App Engine
I'm trying upload images to a bucket in Cloud Storage from an app in GAE and I can't find the way to do this.
I don't have problems when I try do this with a simple program written in python using the library gcloud, this work fine and I can see the pictures in a bucket with the web console but when I try do this inside GAE app (I install gcloud library in /lib folder before) always I find the same error when I import the gcloud library to use:

raise ImportError('No module named %s' % fullname)
ImportError: No module named cryptography.hazmat.bindings._openssl


And I don't undesrtand why when use the library in my localhost this work fine but not inside GAE app.

I thought use JSON API for do this but I want know how is the problem before to change the way to do this.

Thanks you so much for any help, and sorry for my english.

Nick (Cloud Platform Support)

unread,
Mar 29, 2016, 2:34:37 PM3/29/16
to Google App Engine
Hey Juan,

I believe I've figured out what When running in development, packages installed to your python system can appear to resolve dependencies. These will be absent in production for the reason that only your app's folder is uploaded, not all the python packages on your system.

For this reason, many developers work within a virtualenv, so that outside dependencies don't come into the equation. Within the virtualenv, you shouldn't global-install packages, but should install them to a subfolder of your project and explicitly add these using vendoring.

If you inspect the python path (sys.path) in the non-failing example as you currently have it, you'll notice system folders in the path. In production, you'll notice these are missing if you inspect sys.path there. 

I hope this has helped clarify the issue as to why you're seeing an ImportError in production and not in dev. Feel free to post a reply if you find something different.

Best regards,

Nick
Cloud Platform Community Support

Nick (Cloud Platform Support)

unread,
Mar 29, 2016, 3:23:38 PM3/29/16
to Google App Engine
I believe I've figured out what is happening here *
Reply all
Reply to author
Forward
0 new messages