Skip to content

ImportError when using CommonMark-py with Google App Engine #231

Closed
@badersur

Description

@badersur

When I try to use CommonMark-py -which uses python-future- with App Engine I get this error, if I put import CommonMark at the top:

ERROR    2016-08-26 14:04:59,126 wsgi.py:263] 
Traceback (most recent call last):
  File "/home/super/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/home/super/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/home/super/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/super/WebProjects/myapp/blog.py", line 3, in <module>
    from models import Post
  File "/home/super/WebProjects/myapp/models.py", line 1, in <module>
    import CommonMark
  File "/home/super/WebProjects/myapp/libs/CommonMark/__init__.py", line 4, in <module>
    from CommonMark.main import commonmark
  File "/home/super/WebProjects/myapp/libs/CommonMark/main.py", line 15, in <module>
    from CommonMark.dump import dumpAST, dumpJSON
  File "/home/super/WebProjects/myapp/libs/CommonMark/dump.py", line 3, in <module>
    from builtins import str
  File "/home/super/WebProjects/myapp/libs/builtins/__init__.py", line 8, in <module>
    from future.builtins import *
  File "/home/super/WebProjects/myapp/libs/future/builtins/__init__.py", line 10, in <module>
    from future.builtins.iterators import (filter, map, zip)
  File "/home/super/WebProjects/myapp/libs/future/builtins/iterators.py", line 43, in <module>
    from future.types import newrange as range
  File "/home/super/WebProjects/myapp/libs/future/types/__init__.py", line 243, in <module>
    from .newrange import newrange
  File "/home/super/WebProjects/myapp/libs/future/types/newrange.py", line 25, in <module>
    from future.backports.misc import count   # with step parameter on Py2.6
  File "/home/super/WebProjects/myapp/libs/future/backports/__init__.py", line 17, in <module>
    from .misc import (ceil,
  File "/home/super/WebProjects/myapp/libs/future/backports/misc.py", line 900, in <module>
    from subprocess import check_output
ImportError: cannot import name check_output
INFO     2016-08-26 14:04:59,140 module.py:788] default: "GET /blog/5822463824887808 HTTP/1.1" 500 -
INFO     2016-08-26 14:04:59,196 module.py:788] default: "GET /favicon.ico HTTP/1.1" 304 -

But, when I import CommonMark inside a method I get:

ERROR    2016-08-26 13:38:08,116 webapp2.py:1552] cannot import name check_output
Traceback (most recent call last):
  File "/home/super/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "/home/super/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "/home/super/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/home/super/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/home/super/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/home/super/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/home/super/WebProjects/myapp/blog.py", line 29, in get
    self.render('permalink.html', post=post, url=self.url)
  File "/home/super/WebProjects/myapp/handlers.py", line 33, in render
    self.write(self.render_str(template, **kw))
  File "/home/super/WebProjects/myapp/handlers.py", line 30, in render_str
    return render_str(template, **kw)
  File "/home/super/WebProjects/myapp/handlers.py", line 20, in render_str
    return t.render(kw)
  File "/home/super/google_appengine/lib/jinja2-2.6/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/super/WebProjects/myapp/templates/permalink.html", line 1, in top-level template code
    {% extends "base.html" %}
ImportError: cannot import name check_output
INFO     2016-08-26 13:38:08,186 module.py:788] default: "GET /blog/5822463824887808 HTTP/1.1" 500 228
INFO     2016-08-26 13:38:08,281 module.py:788] default: "GET /favicon.ico HTTP/1.1" 304 -

I am used to add other libraries to my App Engine projects as described in App Engine's installing a library document but this library causes these errors even though it is working with webapp2 outside App Engine!

I reported this issue to CommonMark but Mr. @nikolas suggested reporting it here.

Note: I am using App Engine Standard Environment and Python 2.7.12. Also, It seems like App Engine is using version 2.7.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions