Skip to content

Commit

Permalink
Fix incorrect site-packages path breaking app at runtime
Browse files Browse the repository at this point in the history
The keyboard app crashes at launch right now because it has outdated assumptions about the site packages folder and it tries to list things from there. This changes the path accordingly, and avoids a crash in the future if the path shouldn't be present/moved again.
  • Loading branch information
JonasT committed Jan 25, 2019
1 parent 178d552 commit 78ca9e6
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions testapps/testapp_keyboard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@

import os
print('imported os')
import sys
print('imported sys')

from kivy import platform

if platform == 'android':
print('contents of ./lib/python2.7/site-packages/ etc.')
print(os.listdir('./lib'))
print(os.listdir('./lib/python2.7'))
print(os.listdir('./lib/python2.7/site-packages'))
site_dir_path = './_python_bundle/site-packages'
if not os.path.exists(site_dir_path):
print('warning: site-packages dir not found: ' + site_dir_path)
else:
print('contents of ' + site_dir_path)
print(os.listdir(site_dir_path))

print('this dir is', os.path.abspath(os.curdir))

print('contents of this dir', os.listdir('./'))

with open('./lib/python2.7/site-packages/kivy/app.pyo', 'rb') as fileh:
print('app.pyo size is', len(fileh.read()))
if (os.path.exists(site_dir_path) and
os.path.exists(site_dir_path + '/kivy/app.pyo')
):
with open(site_dir_path + '/kivy/app.pyo', 'rb') as fileh:
print('app.pyo size is', len(fileh.read()))

import sys
print('pythonpath is', sys.path)
Expand Down

0 comments on commit 78ca9e6

Please sign in to comment.