"Can't open file for writing" error

Samsung S6-Lite tablet, Android 10.
Krita 4.4.2

I’ve gotten this error several times. The first few times it occured in a google drive folder, so I chalked it up to some problem with remote-local syncing and moved my save location.

For a few weeks it seemed okay but tonight it’s happened again. I was able to save the file after pressing Ok and trying again, this time by not writing a filename and just allowing Krita to use “untitled.kra”. After that I was able to use Save As and use my own name.

When I first saw this I had been using G-Drive for about a week with no problem. Then one day I just couldn’t save the doc I had been working on for a couple days. And I couldn’t save to new files in the same location either.

The error messages back then also used a url-encoded path, but I don’t recall if it was the whole thing or just the last part like tonight.


Krita

Version: 4.4.2
Languages: C
Hidpi: true

Qt

Version (compiled): 5.12.9
Version (loaded): 5.12.9

OS Information

Build ABI: arm64-little_endian-lp64
Build CPU: arm64
CPU: arm64
Kernel Type: linux
Kernel Version: 4.14.113-20302527
Pretty Productname: Android (10.0)
Product Type: android
Product Version: 10.0
Desktop:

OpenGL Info

Vendor: “ARM”
Renderer: “Mali-G72”
Version: “OpenGL ES 3.2 v1.r19p0-01rel0.###other-sha0123456789ABCDEF0###”
Shading language: “OpenGL ES GLSL ES 3.20”
Requested format: QSurfaceFormat(version 2.0, options QFlagsQSurfaceFormat::FormatOption(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile)
Current format: QSurfaceFormat(version 3.2, options QFlagsQSurfaceFormat::FormatOption(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile)
Version: 3.2
Supports deprecated functions false
is OpenGL ES: true

QPA OpenGL Detection Info
supportsDesktopGL: false
supportsOpenGLES: true
isQtPreferOpenGLES: true

Hardware Information

GPU Acceleration: angle
Memory: 3713 Mb
Number of Cores: 8
Swap Location: /data/data/org.krita/files

Current Settings

Current Swap Location: /data/data/org.krita/files
Current Swap Location writable: true
Undo Enabled: true
Undo Stack Limit: 100
Use OpenGL: true
Use OpenGL Texture Buffer: true
Use AMD Vectorization Workaround: false
Canvas State: OPENGL_SUCCESS
Autosave Interval: 900
Use Backup Files: true
Number of Backups Kept: 1
Backup File Suffix: ~
Backup Location: Same Folder as the File
Backup Location writable: false
Use Win8 Pointer Input: false
Use RightMiddleTabletButton Workaround: false
Levels of Detail Enabled: false
Use Zip64: false

Display Information
Number of screens: 1
Screen: 0
Name:
Depth: 32
Scale: 1.50019
Resolution in pixels: 1333x752
Manufacturer:
Model:
Refresh Rate: 60

Honestly, I have no idea what might be up. Do you see any pattern which can possibly help debug? Maybe it’s the url or the file size or some specific layer type…

No suggestions but a couple questions come to mind. %3A is :, so why are 2 of them in the path? (one at beginning and one in middle). The 2nd is also where the encoding starts, before that all / are left un-encoded.

In Samsung Files app the path to the art folder is “Internal storage > Pictures > Art”. In Fx File Explorer it is both /mnt/sdcard/Pictures/Art and “Main storage > Pictures > Art”. I don’t have an sdcard but the decive is sd capable.

Edit: the google drive Krita docs I had troubles with initially were complex with multiple external file link layers (all saved together in g-drive) and free transform layers. Yesterday’s drawing is very simple: a white background layer and a paint layer, inked with a single brush and no filters.

It is expected, the first part, scheme and authority are considered “safe”. Only the “unsafe” chars are encoded.

Could you please attach a log file while this happens, you’d have to enable log view docker and then enable File loading and saving? Link: Getting Krita logs — Krita Manual 5.2.0 documentation

Maybe we can get some clue from there.

Save As to Google drive, after opening from same location:

I got a log too but forum says only image files can be uploaded.

Link to log: https://drive.google.com/file/d/1QO5haeozNpqjPLm6ZnX7fGlRKSMMe2Vv/view?usp=drivesdk

Stupid question: you’re sure your storage device is not full, or nearly so?

The same file, this time Save As to internal storage:

log link: https://drive.google.com/file/d/19e1RYlX8Z8KxQeK-Kd-hI5oiTa1pn-VL/view?usp=drivesdk

Not a stupid question, but no I have lots of room, only 28 of 128GB is used.

Thanks a lot! I am able to reproduce it with files from GDrive. I will try to fix it for the upcoming release.

Hello!

I have pushed the fix. But I couldn’t reproduce the error messages you have in log, this makes me a bit concerned. Have you tried reinstalling/clearing cache? (If you haven’t yet, then please don’t do it now). Did the problem persist?

I cleared the app cache and still get the error. Some additional info: the file is created, but is zero bytes.

  1. I opened a file from google drive > Save As > type new name > Save: error.

  2. With same file > Save As > internal storage > type name > Save : error.

  3. Save As > internal storage > let Krita set the name (Untitled) > Save : OK.

  4. Save As > internal > type name > Save: OK.

  5. Save As > G drive > let Krita set name > Save : error.

This was all in one session.
https://drive.google.com/file/d/19r5B4-SteYtpmsm_T0_tMwnPmvmX_r6x/view?usp=drivesdk



Screenshot of App Info. The breakdown of storage by location is new to me. Does anyone know how to see what or where the items in each of those categories are? And, what does “Clear Data” do ? ( vs “clear cache” )

Could you please test the same with this APK: krita-file-test.apk - Google Drive. I built it with the patch and is named “Krita-test2”, it should install itself side-by-side without needing to uninstall the Play Store version.

I think, they are generalized path classification in Android. Like, if you save in Downloads folder they go under Download Manager. If you save in Pictures they are classified as Media Storage.

Clear Data will clear app’s internal+app-specific external data (Non of the external user, like Download, Media). Clear cache will well… clear the app cache.

Wonderful! with that apk I can’t reproduce the error anymore.

That’s amazing! This will likely get to our next beta. It is a rather serious change. If you find bugs in this or the next beta feel free to ping me here or on IRC.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.