Skip to content

Commit 78ca9e6

Browse files
author
JonasT
committed
Fix incorrect site-packages path breaking app at runtime
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.
1 parent 178d552 commit 78ca9e6

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

testapps/testapp_keyboard/main.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,28 @@
22

33
import os
44
print('imported os')
5+
import sys
6+
print('imported sys')
57

68
from kivy import platform
79

810
if platform == 'android':
9-
print('contents of ./lib/python2.7/site-packages/ etc.')
10-
print(os.listdir('./lib'))
11-
print(os.listdir('./lib/python2.7'))
12-
print(os.listdir('./lib/python2.7/site-packages'))
11+
site_dir_path = './_python_bundle/site-packages'
12+
if not os.path.exists(site_dir_path):
13+
print('warning: site-packages dir not found: ' + site_dir_path)
14+
else:
15+
print('contents of ' + site_dir_path)
16+
print(os.listdir(site_dir_path))
1317

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

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

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

2128
import sys
2229
print('pythonpath is', sys.path)

0 commit comments

Comments
 (0)