Skip to content

Commit 551a34e

Browse files
authored
Merge pull request #1610 from kivy/JonasT-fix-keyboardapp
Fix incorrect site-packages path breaking keyboard test app at runtime
2 parents e8fcc32 + 4668991 commit 551a34e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

testapps/testapp_keyboard/main.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,29 @@
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

21-
import sys
2228
print('pythonpath is', sys.path)
2329

2430
import kivy

0 commit comments

Comments
 (0)