Note that there are some explanatory texts on larger screens.

plurals
  1. POGAE Python ImportError: No module -- works locally but not in cloud
    primarykey
    data
    text
    <p>This works just fine on local development. However, I hit the problem when I deploy to production. The error I receive is the following:</p> <pre><code>Traceback (most recent call last): File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 196, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "/python27_runtime/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler handler = __import__(path[0]) ImportError: No module named shamn </code></pre> <p>Here is my app.yaml file for reference:</p> <pre><code>application: shaman-labz version: 1-4 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /css static_dir: css - url: /s static_dir: s - url: /api.* script: shamn.app - url: /.* script: helloworld.app libraries: - name: jinja2 version: latest </code></pre> <p>I have tried everything I can think of to double-check any potential naming conflicts. helloworld.app works with both local and cloud, but /api.* is apparently properly mapping to shamn.app, but is not seeing 'shamn' for some reason. i have checked and triple checked that shamn.py exists within the root directory (same directory as app.yaml and helloworld.py). I renamed to shamn.py because previously I had a static directory named shaman that i thought might be causing a conflict in the cloud. i even tried changing versions from 1.3 --> 1.4 to make sure everything is clean...etc...still unable to figure out why this is happening...note that at each step of the process, i verified functionality in the local dev environment before pushing to the cloud. since this is purely a server-side problem, i did not bother to clear any cache on the client, but i can see from the logs that the request is coming to the proper url (/api/test, /api?, /api/etc (and every other reasonable combination just in case). doesn't work...arrrggg. what am i doing wrong? </p> <p>For reference, here is my VERY simple test shamn.py (which i am going to try again and rename) [update-just to remove any unknowns, i removed json from the equation...</p> <pre><code>import jinja2 import os #import json jinja_environment = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__))) import webapp2 class MainPage(webapp2.RequestHandler): def get(self): template_values = { 'greetings': [], 'url': 'url', 'url_linktext': 'url_linktext' } template = jinja_environment.get_template('index.html') self.response.out.write(template.render(template_values)) class testclass(webapp2.RequestHandler): def get(self): self.response.out.write('hello world from testclass.get') def post(self): #jsonobj = json.loads(self.request.body) #self.response.out.write(json.dumps(jsonobj)) self.response.out.write(self.request.body) app = webapp2.WSGIApplication([ ('/api/test.*', testclass), ('/api.*', MainPage) ],debug=True) </code></pre> <p>this works in dev, but not in production. and yes, 'index.html' is verified to exist (shared with helloworld.app) so i think i can rule that out). please note, i have worked with GAE off and on over many years and I've never been this stumped, and on something seemingly so simple. i've had to hack out all my essential code and i'm back to a stump of code now...one of the disadvantages of working offline for two weeks and not pushing to the cloud (this could have been caught earlier).</p> <p>any help would be greatly appreciated. </p> <p>...update, well it's the next morning and i'm still stumped...the next thing I am going to do is just create a new file. all that i am trying to accomplish is to post some json from the client to the server using simplified xmlhttprequest. this should not be a cross-domain issue as the page is being loaded from the same domain. besides, the request is getting far enough to at least recognize that shamn (a python module) should exist but it cannot find it. this is already renamed once, so i'm going to just 'tinker' and see how i find a resolution. the main problem is that each time i try a change to the the code requires that i re-upload to the cloud, because I am unable to duplicate in dev. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload