Shopify Django/GAE API - django

When attempting to set this up, I am encountering the following error:
Traceback (most recent call last):
File "manage.py", line 11, in <module>
import settings
File "/Users/Paul/Documents/shopifywarrantymanager/settings.py", line 7, in <module>
from djangoappengine.settings_base import *
File "/Users/Paul/Documents/shopifywarrantymanager/djangoappengine/settings_base.py", line 6, in <module>
setup_env()
File "/Users/Paul/Documents/shopifywarrantymanager/djangoappengine/boot.py", line 64, in setup_env
setup_project()
File "/Users/Paul/Documents/shopifywarrantymanager/djangoappengine/boot.py", line 114, in setup_project
from .utils import have_appserver, on_production_server
File "/Users/Paul/Documents/shopifywarrantymanager/djangoappengine/utils.py", line 12, in <module>
appconfig, unused = dev_appserver.LoadAppConfig(PROJECT_DIR, {})
ValueError: too many values to unpack
I have not altered the files in any way other than adding my API key/shared secret, and changing the application name in 'app.yaml' to the one I registered with GAE.

I think you are using an old version of Djangoappengine.
The method LoadAppConfig since SDK 1.6 returns a tuple of three values (AppInfoExternal, URLMatcher, from_cache); the code in utils.py is wrong because is expecting just two values from it.
If you look into a more updated version of Djangoappengine you can see that the method is correctly called:
appconfig = dev_appserver.LoadAppConfig(PROJECT_DIR,
{},
default_partition='dev')[0]

Related

Attribute Error: 'module' object has no attribute 'GraphKeys'

I'm currently trying to get a chatbot running with tensorflow.
The example for the chatbot is from this repository:
Github
I ran into some issues when I tried to run this in my tensorflow docker container.
When starting the script the script exits with an Attribute Error.
Traceback (most recent call last):
File "chatbot.py", line 5, in <module>
import tensorlayer as tl
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/__init__.py", line 47, in <module>
from tensorlayer import initializers
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/initializers.py", line 7, in <module>
from tensorlayer.layers.core import LayersConfig
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/layers/__init__.py", line 12, in <module>
from .activation import *
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/layers/activation.py", line 6, in <module>
from tensorlayer.layers.core import Layer
File "/usr/local/lib/python2.7/dist-packages/tensorlayer/layers/core.py", line 39, in <module>
TF_GRAPHKEYS_VARIABLES = tf.GraphKeys.GLOBAL_VARIABLES
AttributeError: 'module' object has no attribute 'GraphKeys'
I'm using the following Versions:
tensorflow 2.0.0a0
tensorlayer 1.11.1
Maybe some of you had already a similar issue and knows how I could solve this problem.
I solved this problem using pip install tensorflow==1.13.2
Maybe tl mismatch tf, you need to update your tensorlayer to 2.0+.you can use this instruction:
pip3 install https://github.com/tensorlayer/tensorlayer/archive/master.zip

ImportError: No module named _openssl in GAE

Actually I am uploading python app (which using pusher module) on GAE. Its working fine on my local system. But in GAE(Google App Engine) Its giving following error when I host this app to GAE.
Traceback (most recent call last): (/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/cgi.py:122)
File "/base/data/home/apps/s~pushapi-1117/1.388696378960329626/main.py", line
26, in <module>
secret=secret
File "lib/pusher/pusher.py", line 42, in __init__ from pusher.requests
import RequestsBackend
File "lib/pusher/requests.py", line 12, in <module>
import urllib3.contrib.pyopenssl
File "lib/urllib3/contrib/pyopenssl.py", line 53, in <module>
import OpenSSL.SSL
File "lib/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "lib/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "lib/OpenSSL/_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "lib/cryptography/hazmat/bindings/openssl/binding.py", line 13, in
<module>
from cryptography.hazmat.bindings._openssl import ffi, lib
**ImportError: No module named _openssl**
I have installed all the dependent modules cryptography, OpenSSL also then also I am getting this problem. This error is coming only when I am hosting my app on GAE.
GAE doesn't support C extensions and pyca/cryptography (which pyOpenSSL depends on) imports C extensions (via cffi). Google has more information about the requirements for Python libraries on GAE.

PyDev: Can't compile after accidentally naming file after Python io.py

So I without thinking stupidly named a file io.py in my working directory. When I tried to compile I got a traceback error. Having realised what I'd done I renamed my file and updated references to it but I still get the following error:
Traceback (most recent call last):
File "C:\Users\Tom\workspace\Converter\get_file.py", line 9, in <module>
from scipy import complex_
File "C:\Python27\lib\site-packages\scipy\__init__.py", line 70, in <module>
from numpy import show_config as show_numpy_config
File "C:\Python27\lib\site-packages\numpy\__init__.py", line 185, in <module>
from . import add_newdocs
File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Python27\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 46, in <module>
from numpy.testing import Tester
File "C:\Python27\lib\site-packages\numpy\testing\__init__.py", line 13, in <module>
from .utils import *
File "C:\Python27\lib\site-packages\numpy\testing\utils.py", line 15, in <module>
from tempfile import mkdtemp
File "C:\Python27\lib\tempfile.py", line 32, in <module>
import io as _io
File "C:\Users\Tom\workspace\Converter\io.py", line 1, in <module>
"""The io module provides the Python interfaces to stream handling. The
File "C:\Users\Tom\workspace\Converter\get_file.py", line 9, in <module>
from scipy import complex_
ImportError: cannot import name complex_
I have restarted PyDev to no avail. I have refreshed the interpreter to no avail.
I have followed the instructions found in this Python issue but that command returns the correct result on my machine.
Is tempfile.py a temporary file I can remove to resolve this issue?
I have found the solution. Stupidly simple but maybe worth leaving here for other newbies who fall into the same trap.
PyDev compiles the code into *.pyc files. When you update the references and rename the files these aren't immediately recompiled. Deleting the io.pyc file I had allowed compilation too run properly.
I found some more info on common pitfalls too.

Cannot add extra scope when running Datastore Wordcount Example

I am attempting to run the DatastoreWordCountExample from the Dataflow SDK.
The instructions indicate that I should run the following commands:
$ export CLOUDSDK_EXTRA_SCOPES=https://www.googleapis.com/auth/datastore
$ gcloud auth login
However, when I do, I receive the following error:
$ export CLOUDSDK_EXTRA_SCOPES=https://www.googleapis.com/auth/datastore
$ gcloud auth login
Traceback (most recent call last):
File "/Users/brian/opt/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 91, in <module>
from googlecloudsdk.calliope import base
File "/Users/brian/opt/google-cloud-sdk/./lib/googlecloudsdk/calliope/base.py", line 8, in <module>
from googlecloudsdk.calliope import usage_text
File "/Users/brian/opt/google-cloud-sdk/./lib/googlecloudsdk/calliope/usage_text.py", line 12, in <module>
from googlecloudsdk.calliope import arg_parsers
File "/Users/brian/opt/google-cloud-sdk/./lib/googlecloudsdk/calliope/arg_parsers.py", line 42, in <module>
from googlecloudsdk.core import log
File "/Users/brian/opt/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 12, in <module>
from googlecloudsdk.core import properties
File "/Users/brian/opt/google-cloud-sdk/./lib/googlecloudsdk/core/properties.py", line 10, in <module>
from googlecloudsdk.core import config
File "/Users/brian/opt/google-cloud-sdk/./lib/googlecloudsdk/core/config.py", line 293, in <module>
_CheckForExtraScopes()
File "/Users/brian/opt/google-cloud-sdk/./lib/googlecloudsdk/core/config.py", line 291, in _CheckForExtraScopes
CLOUDSDK_SCOPES.extend(extra_scopes.split())
AttributeError: 'tuple' object has no attribute 'extend'
Note that gcloud runs find as long as CLOUDSDK_EXTRA_SCOPES is unset in my environment variables.
According to https://code.google.com/p/google-cloud-sdk/issues/detail?id=128 it seems that you no longer need to set this variable for datastore to work. Can you please try that and tell us if it doesn't work?
(meanwhile I'll update the docs)

Using django-syncr to create flickr feed

I'd like to put a flickr feed on my homepage using django-syncr; I followed the instructions on the homepage (http://code.google.com/p/django-syncr/), and the installation process was pretty smooth. Steps 1-3 work just fine, but Step 4 is where I run into problems.
When I try to run the commands shown:
from syncr.app.flickr import FlickrSyncr
I get the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/django_syncr-0.50-py2.7.egg/sync/app/flickr.py", line 11, in <module>
from syncr.flickr.models import *
File "/usr/local/lib/python2.7/dist-packages/django_syncr-0.50-py2.7.egg/syncr/flickr/models.py", line 1, in <module>
from django.db import models
File "/usr/lib/python2.7/dist-packages/django/db/__init__.py", line 14, in <module>
if not settings.DATABASES:
File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 276, in __getattr__self._setup()
File "/usr/lib/python2.7/dist-packages/django/conf/__init__.py", line 40, in _setup
raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
And I'm not really sure what to do. These files are run in my django project folder, but including the settings file (via import settings) doesn't seem to fix this. What files should be included in order to import the right variables?
thanks!