chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
749 stars 128 forks source link

subprocess.run(sys.executable) fails with "Error changing dalvik-cache ownership : Permission denied" #1066

Closed deva666 closed 5 months ago

deva666 commented 6 months ago

Chaquopy version

15.0.1

Devices or emulators where the issue happens

OnePlus 7 Pro

Relevant parts of your code

import sys
subprocess.run([f'{sys.executable}' , filename],capture_output=True,input='\n',text=True,timeout=0.75)

Describe your issue

Trying to run a Python script with the above code, the stderr of CompletedProcess result returns Error changing dalvik-cache ownership : Permission denied

mhsmith commented 5 months ago

Chaquopy is embedded in the Android app process, and doesn't provide a Python executable, so you can't run Python subprocesses in this way. Instead, try using runpy.run_path.