kivy / kivy-launcher

Reboot of the older Kivy launcher
MIT License
108 stars 56 forks source link

the directory of the main.py(not Kivy Launcher's main.py) not in sys.path #2

Closed gottadiveintopython closed 6 years ago

gottadiveintopython commented 6 years ago

Hi, 2 days ago I built a Kivy Launcher APK(python3crystax==3.5, kivy==master)and found a problem.

# main.py
import sys
import os.path

print(sys.path)
print(os.path.abspath('.'))

I placed main.py to /sdcard/kivy/test and ran.

# sys.path
.
/data/data/jp.gottadiveintopython.kivylauncher/files/app/crystax_python/stdlib.zip
/data/data/jp.gottadiveintopython.kivylauncher/files/app/crystax_python/modules
/data/data/jp.gottadiveintopython.kivylauncher/files/app/crystax_python/site-packages

# current directory
/data/data/jp.gottadiveintopython.kivylauncher/files/app

/sdcard/kivy/test not in sys.path so I wrote sys.path.append(os.path.dirname(__file__)) in main.py to avoid ImportError.

Also need fix

https://github.com/kivy/kivy-launcher/blob/master/main.py#L36 run_entrypoint(entrypoint, orientation=orientation) -> run_entrypoint(entrypoint)

tito commented 6 years ago

I added a fix for the orientation, however, i don't unsderstand the import error :/ Here the path is correctly changed, but maybe because i use python2.7 ?

tito commented 6 years ago

Fixed in ad5c5c6

gottadiveintopython commented 6 years ago

I'm struggling with buildozer. (The problem is not related to Kivy-Launcher) So I can't test it yet. But anyways thank you.