File: mergeall-android-scripts/_readme-items/PYDROID3-TKINTER/CODE/_permissions-cross-app.py

#-------------------------------------------------------------
# More permissions tests, run in the Pydroid 3 app.
#
# Pydroid 3 has read+write access to Termux's app-specific 
# folder in internal storage, but this folder is read only 
# on removable media like SD cards and USB drives.  Using
# both apps to update the same data requires internal storage.
#-------------------------------------------------------------


# 
# Internal storage: these both work
#

print(open('/sdcard/Android/data/com.termux/rtest.txt').read())

open('/sdcard/Android/data/com.termux/rtest.txt', 'w').write('zxcv')


#
# SD card: the first works, but the second fails on a permissions error
#

print(open('/storage/5C32-5336/Android/data/com.termux/rtest.txt').read())

open('/storage/5C32-5336/Android/data/com.termux/rtest.txt', 'w').write('zxcv')



[Home page] Books Code Blog Python Author Train Find ©M.Lutz