Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import gevent -> ImportError: cannot import name core #288

Closed
alanjds opened this issue Oct 25, 2014 · 2 comments
Closed

import gevent -> ImportError: cannot import name core #288

alanjds opened this issue Oct 25, 2014 · 2 comments

Comments

@alanjds
Copy link
Contributor

alanjds commented Oct 25, 2014

Trying to port the interactive console to "minimal" bootstrap, got an issue importing gevent:

ImportError: cannot import name core

Researched, and looks like "gevent is being imported from its build folder": http://stackoverflow.com/a/2312205/798575

Follows my main.py and logs:

# main.py
__version__ = '0.1'

print 'Trying to import gevent'
try:
    import gevent
    from gevent.backdoor import BackdoorServer
except ImportError:
    print 'Failed. Trying to fix the path'
    import os
    print 'PATH:', os.sys.path
    print 'PWD:', os.getcwd()
    os.chdir("..")
    print 'PWD:', os.getcwd()
    print 'Trying to import again'
    import gevent
    from gevent.backdoor import BackdoorServer

print 'Success. Trying to bring the console shell'
server = BackdoorServer(['127.0.0.1', 5001],
                        locals={'foo': "From defined scope!"})
server.serve_forever()

Bash commands used to build the APK:

./distribute.sh -b minimal -m 'python gevent pyasn1 pycrypto pyopenssl'
./build.py --package org.minimal.test --name _MINIMAL --version 1 --asset --private ~/src/git/p4a-minimal-shell/ debug installd

ADB logcat:

10-14 08:49:55.250: I/python(5361): Starting minimal bootstrap.
10-14 08:49:55.250: I/python(5361): Initialize Python for Android
10-14 08:49:55.263: D/WifiStateMachine(1066): handleMessage: X
10-14 08:49:55.267: I/python(5361): Looked up package code path: /data/app/org.minimal.test-1.apk
10-14 08:49:55.267: I/python(5361): Looked up library code path: /data/app-lib/org.minimal.test-1
10-14 08:49:55.267: I/python(5361): Internal data path is: /data/data/org.minimal.test/files
10-14 08:49:55.267: I/python(5361): External data path is: /storage/emulated/0/Android/data/org.minimal.test/files
10-14 08:49:55.268: I/python(5361): Run _bootstrap.py >>>
10-14 08:49:55.275: D/dalvikvm(1160): GC_CONCURRENT freed 105K, 37% free 21749K/34160K, paused 3ms+3ms, total 31ms
10-14 08:49:55.383: I/python(5361): Bootstrapping module: "main"
10-14 08:49:55.389: I/python(5361): Trying to import gevent
10-14 08:49:55.391: I/python(5361): Failed. Trying to fix the path
10-14 08:49:55.391: I/python(5361): PATH: ['/data/app/org.minimal.test-1.apk/assets', '/data/app/org.minimal.test-1.apk/assets/lib/python2.7/', '/data/app/org.minimal.test-1.apk/assets/lib/python2.7/site-packages/']
10-14 08:49:55.391: I/python(5361): PWD: /
10-14 08:49:55.392: I/python(5361): PWD: /
10-14 08:49:55.392: I/python(5361): Trying to import again
10-14 08:49:55.393: I/python(5361): Traceback (most recent call last):
10-14 08:49:55.393: I/python(5361):   File "/data/data/org.minimal.test/files/_bootstrap.py", line 127, in <module>
10-14 08:49:55.394: I/python(5361):     runpy._run_module_as_main(main_module, False)
10-14 08:49:55.394: I/python(5361):   File "/Users/alanjds/src/git/python-for-android/build/python-install/lib/python2.7/runpy.py", line 162, in _run_module_as_main
10-14 08:49:55.394: I/python(5361):   File "/Users/alanjds/src/git/python-for-android/build/python-install/lib/python2.7/runpy.py", line 72, in _run_code
10-14 08:49:55.394: I/python(5361):   File "/Users/alanjds/src/git/p4a-minimal-shell/main.py", line 15, in <module>
10-14 08:49:55.394: I/python(5361):   File "/Users/alanjds/src/git/python-for-android/dist/default/private/lib/python2.7/site-packages/gevent/__init__.py", line 40, in <module>
10-14 08:49:55.395: I/python(5361): ImportError: cannot import name core
10-14 08:49:55.395: I/python(5361): Run _bootstrap.py (ret=-1) <<<
10-14 08:49:55.406: I/python(5361): Python for android ended.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@alanjds
Copy link
Contributor Author

alanjds commented Feb 14, 2019

I dont see this "fixed", but looks like nobody cares anymore. If redoing it, I would go with Python3+asyncio anyway.

@AndreMiras
Copy link
Member

Yes to be honest, this was probably closed as stale since as you said nobody seemed to care.
But if you've tried again and confirm it's still an issue then maybe we/you should take a look.
As far as I remember I've already played with gevent in one of my apps. Well it was a sub dependency and I haven't tried importing it directly.
So do you confirm this is still an issue? On p4a master? If so please reopen with updated debug log and way to reproduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants