0

My staging GAE app throws the below err,

File "/base/data/home/apps/foo156801/worker:20170301t222555.399535951340506041/lib/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dynamic module does not define init function (init_mysql)

which was exactly same as this. According to the answer given on that link, I have changed my app.yaml MysqlDb version and the local mysqldb version to points to a same version. But no luck. Still I got the above error.

app.yaml

libraries:
 - name: jinja2
   version: latest
 - name: MySQLdb
   version: "1.2.5"

requirements.txt

Flask-API==0.6.9
MySQL-python==1.2.5
8
  • No, I made the requirements.txt file for to installing third party packages into lib folder. ie, pip install -r requirements.txt -t lib Commented Mar 2, 2017 at 4:58
  • Ah, I see, never mind :) Commented Mar 2, 2017 at 5:05
  • If I remove mysqldb package from my lib folder with the builtin mysqldb entry exists, it shows No module named MySQLdb. And if I remove the builtin entry and the mysqldb package still exists on my lib folder then it shows the above error. Commented Mar 2, 2017 at 5:10
  • @Dan But queries on default module works perfectly file.. But the db queries on worker module or service throws the above exception. I have /api/users/list endpoint on my default module which gets all the users from the database.. It works just fine.. Commented Mar 3, 2017 at 7:13
  • But on the another api, I have set the default module to call a task which actually exists on worker module, say /send-email in worker.py . In this handler I added a query to search in one of my tables . This causes error. Commented Mar 3, 2017 at 7:16

1 Answer 1

1

The multiple services/modules of an application do not share any code, see Service isolation.

Because of this requesting runtime-provided libraries or vendoring in 3rd party libraries needs to be replicated in each service/module.

Symlinks can also be used for vendoring in 3rd party libs in DRY spirit, see Sharing entities between App Engine modules.

Sign up to request clarification or add additional context in comments.

4 Comments

So it won't share also the environment variables? Like in the default module , i set foo: bar in app.yaml. Can I access that env variable in worker.py os.environ.get('foo', 'None'). Is this would return None?
Yep, worker.yaml needs its instructions as well. This may help: stackoverflow.com/questions/33307128/…
Fundamentally the modules are completely isolated from the code prospective, the worker module could be a flex env module, written in another language, with a totally different style of configurations.
ya, I already tested worker module completely written in php lang.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.