Closed bv-noake closed 4 years ago
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.wit, PID: 25369
java.lang.IllegalStateException: Could not execute method for android:onClick
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:402)
at android.view.View.performClick(View.java:7125)
at android.view.View.performClickInternal(View.java:7102)
at android.view.View.access$3500(View.java:801)
at android.view.View$PerformClick.run(View.java:27336)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:397)
at android.view.View.performClick(View.java:7125)
at android.view.View.performClickInternal(View.java:7102)
at android.view.View.access$3500(View.java:801)
at android.view.View$PerformClick.run(View.java:27336)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: com.chaquo.python.PyException: OSError: [Errno 30] Read-only file system: 'myfile.jpg'
at
If you want to read a file included with your source code, please see #144.
If you want to write a file, use getFilesDir
as described in https://github.com/chaquo/chaquopy/issues/177#issuecomment-557496897.
How would i use this line to make a jpg file:
df_signaures.to_csv(files_dir+'graduate_signatures.csv')
I'm not familiar with the library you're using, but if you want to construct a filename, then you'll need to do it like this:
files_dir + "/" + filename
or this:
from os.path import join
join(files_dir, filename)
I'm not sure why you've re-asked the original question on StackOverflow: you won't get a better answer than what I've already provided. If you need some clarification then let's continue the conversation here.
i want to write a file so that i can see it in my phone's internal storage..plz tell how to do...
As I wrote above, you can use getFilesDir
as described in https://github.com/chaquo/chaquopy/issues/177#issuecomment-557496897.
sorry sir, but i did the same...but i cannot locate the file in my mobile's file manager...plz give a full demostration and share the related documents....thank you sir
More specifically i want to write a file to the downloads folder of my internal storage
check this and plz help me solve
The Android documentation refers to the downloads folder as "external storage", although most recent phones store it on the same hardware as everything else.
Unfortunately the rules around accessing external storage are complex and have changed several times in the history of Android. For details, see https://github.com/chaquo/chaquopy/issues/38#issuecomment-388632574.
Hi, I have this code that i am using to write to a file, I know it works as i have tested it normally using python however, when i try to use it in android studio it tells me the file is read only.
images.execute("SELECT Picture FROM Pictures") record = images.fetchall() for row in record: photo = row[0]