Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 02-26-2024, 03:22 AM   #1
jomteon
Junior Member
jomteon began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Feb 2024
Device: none
Permission error preventing the use of DeDRM

Currently trying to get DeDRM working. When I click the configuration option "Kindle for Android ebooks" and choose a backup file, I get a message that says it cannot open it as a temp file is already running. The full error is:

Code:
calibre, version 7.5.1
ERROR: Cannot open file or folder as it is in use: <p>Could not open the file: "C:\Users\MyName\AppData\Local\Temp\tmpka_r7mog". It is already opened in the following programs:<div>The main calibre program: C:\Program Files\Calibre2\calibre.exe

calibre 7.5.1  embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.11.5
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre2\calibre.exe
Successfully initialized third party plugins: DeDRM (7, 2, 1)
Traceback (most recent call last):
  File "calibre_plugins.dedrm.config", line 952, in get_android_file
  File "calibre_plugins.dedrm.androidkindlekey", line 303, in get_serials
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\MyName\\AppData\\Local\\Temp\\tmpka_r7mog'
Things I've done to remedy this:
  • of course rebooting
  • going into the Windows 10 environment variables. I tried both "user variables" and "system variables" clicking on New and setting the Variable to CALIBRE_TEMP_DIR and the Value to a different folder to hold temp files. (I rebooted after this as well)
  • I also tried to change the temp folder by starting up calibre with a batch file, using the line

Code:
set CALIBRE_TEMP_DIR=D:\Software\calibre_temp\Temporary\Calibre\temp
None of this has worked. Not only has it not fixed the issue, it seems that my adjustments to the environment variables didn't do anything either. Calibre is still creating the troublesome files in C:\\Users\\MyName\\AppData\\Local\\Temp

I'm completely unsure how to move forward. Any help would be greatly appreciated.
jomteon is offline   Reply With Quote
Old 02-26-2024, 03:35 AM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,644
Karma: 26960534
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Have you asked at the place where you got the plugin, I presume that would be -==>> https://github.com/noDRM/DeDRM_tools

BR
BetterRed is offline   Reply With Quote
Advert
Old 02-26-2024, 04:43 AM   #3
jomteon
Junior Member
jomteon began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Feb 2024
Device: none
I haven't tried that yet, but I will give it a go in addition to this thread.

From my read of the error, it seems like an issue more specifically with how calibre is running on my computer, but I'll ask around where you suggested anyway.
jomteon is offline   Reply With Quote
Old 02-26-2024, 04:57 AM   #4
sgmoore
Connoisseur
sgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfolded
 
Posts: 59
Karma: 52636
Join Date: Mar 2021
Device: Kindle Voyage
Despite the error saying calibre is the culprit, I would suspect your anti-virus program.

After you pick the backup file, the plugin will have to extract one of its files (to the temporary folder), extract the serial number from this file and then delete the file.
I suspect your anti-virus is still scanning the temporary file when the plugin has finished and tries to delete it.
sgmoore is offline   Reply With Quote
Old 02-26-2024, 05:03 AM   #5
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,644
Karma: 26960534
Join Date: Mar 2012
Location: Sydney Australia
Device: none
↑ ↑ ↑ ✔

Also try running in Windows Safe mode?

FWIW: I've been running calibre with CALIBRE_TEMP_DIR set to C:\_AppData\Calibre\Temp for more than a decade, with no problems.

BR
BetterRed is offline   Reply With Quote
Advert
Old 02-26-2024, 05:09 AM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,457
Karma: 129668758
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by BetterRed View Post
↑ ↑ ↑ ✔

Also try running in Windows Safe mode?

FWIW: I've been running calibre with CALIBRE_TEMP_DIR set to C:\_AppData\Calibre\Temp for more than a decade, with no problems.

BR
I've been using the Windows default temp directory ever since calibre was libprs500 and I've had no problem.
JSWolf is offline   Reply With Quote
Old 02-26-2024, 05:18 AM   #7
jomteon
Junior Member
jomteon began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Feb 2024
Device: none
Quote:
Originally Posted by sgmoore View Post
Despite the error saying calibre is the culprit, I would suspect your anti-virus program.

After you pick the backup file, the plugin will have to extract one of its files (to the temporary folder), extract the serial number from this file and then delete the file.
I suspect your anti-virus is still scanning the temporary file when the plugin has finished and tries to delete it.
I went into the windows security settings and turned off the Real-Time Protection and re-opened Calibre and tried again. I got identical results. Can you suggest a better way I could get around Windows Defender to check if that's indeed the issue?
jomteon is offline   Reply With Quote
Old 02-26-2024, 05:20 AM   #8
jomteon
Junior Member
jomteon began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Feb 2024
Device: none
Quote:
Originally Posted by JSWolf View Post
I've been using the Windows default temp directory ever since calibre was libprs500 and I've had no problem.
I'm just trying any/every avenue I can find. And, like I said, it didn't even work, which is its own issue. Like, whether or not it fixes the actual problem with DeDRM, I'm still unable to set the Environment Variable properly, which is odd
jomteon is offline   Reply With Quote
Old 02-26-2024, 05:22 AM   #9
jomteon
Junior Member
jomteon began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Feb 2024
Device: none
Quote:
Originally Posted by BetterRed View Post
↑ ↑ ↑ ✔

Also try running in Windows Safe mode?

BR
I can certainly give that a shot. I'm curious, though, why you think that might fix it?
jomteon is offline   Reply With Quote
Old 02-26-2024, 05:34 AM   #10
sgmoore
Connoisseur
sgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfolded
 
Posts: 59
Karma: 52636
Join Date: Mar 2021
Device: Kindle Voyage
Quote:
Originally Posted by jomteon View Post
I went into the windows security settings and turned off the Real-Time Protection and re-opened Calibre and tried again. I got identical results. Can you suggest a better way I could get around Windows Defender to check if that's indeed the issue?
A workaround would be to find the temporary file (which should still be there) and rename it to map_data_storage.db and then open that file instead of the backup file.
sgmoore is offline   Reply With Quote
Old 02-26-2024, 05:34 AM   #11
jomteon
Junior Member
jomteon began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Feb 2024
Device: none
So, I ran windows in safe mode and tried calibre again and *did* get a sorta new error. One that points to what was said above by sgmoore.

Quote:
ERROR: Cannot open file or folder as it is in use: The file "C:\Users\My Name\AppData\Local\Temp\tmpe8gjs9ji" is opened in another program, so calibre cannot access it.This is usually caused by software such as antivirus or file sync (aka DropBox and similar) accessing files in the calibre library folder at the same time as calibre. Try excluding the calibre library folder from such software.
So, now the question is: How do I figure out what program is holding calibre hostage? It doesn't seem to be Windows Defender, so how can I track it down?
jomteon is offline   Reply With Quote
Old 02-26-2024, 05:47 AM   #12
jomteon
Junior Member
jomteon began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Feb 2024
Device: none
Wait. It tells me what's holding it hostage... Calibre itself.

Could not open the file: "C:\Users\MyName\AppData\Local\Temp\tmpc0j69a3 ". It is already opened in the following programs:
The main calibre program: C:\Program Files\Calibre2\calibre.exe

Quote:
Originally Posted by sgmoore View Post
A workaround would be to find the temporary file (which should still be there) and rename it to map_data_storage.db and then open that file instead of the backup file.
It creates a new temporary file each time I run DeDRM, so I'm not sure how that would help. But I may just be misunderstanding you here.

Last edited by jomteon; 02-26-2024 at 05:50 AM. Reason: image didn't attach, so i typed it out instead
jomteon is offline   Reply With Quote
Old 02-26-2024, 06:03 AM   #13
sgmoore
Connoisseur
sgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfolded
 
Posts: 59
Karma: 52636
Join Date: Mar 2021
Device: Kindle Voyage
Quote:
Originally Posted by jomteon View Post

It creates a new temporary file each time I run DeDRM, so I'm not sure how that would help. But I may just be misunderstanding you here.
The plugin is extracting map_data_storage.db to a file in the temporary folder and lets windows just generate a random filename (which is why the name is different each time). Then it reads the serial number from this file and deletes it - which is line 303 that throws the error.

All this is doing is bypassing the backup extraction and is reading the serial number from the map_data_storage.db file directly and, most importantly, the plugin won't delete map_data_storage.db , so we skip the line that is causing the error.
sgmoore is offline   Reply With Quote
Old 02-26-2024, 06:09 AM   #14
sgmoore
Connoisseur
sgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfoldedsgmoore reads XML... blindfolded
 
Posts: 59
Karma: 52636
Join Date: Mar 2021
Device: Kindle Voyage
Quote:
Originally Posted by jomteon View Post

So, now the question is: How do I figure out what program is holding calibre hostage? It doesn't seem to be Windows Defender, so how can I track it down?
My usual method is to download and run Process Monitor from https://learn.microsoft.com/en-us/sy...nloads/procmon

It records a lot of information, so it is best not to leave it running very long and to set the initial filter to be

Path Contains C:\Users\Your Name\AppData\Local\Temp

This will show you all processes that use the temporary folder.

Once you have got the error and you know the actual file name, you can change the filter to just show processes that use that filename
sgmoore is offline   Reply With Quote
Old 02-26-2024, 08:29 AM   #15
jomteon
Junior Member
jomteon began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Feb 2024
Device: none
Quote:
Originally Posted by sgmoore View Post
The plugin is extracting map_data_storage.db to a file in the temporary folder and lets windows just generate a random filename (which is why the name is different each time). Then it reads the serial number from this file and deletes it - which is line 303 that throws the error.

All this is doing is bypassing the backup extraction and is reading the serial number from the map_data_storage.db file directly and, most importantly, the plugin won't delete map_data_storage.db , so we skip the line that is causing the error.
Thank you for clarifying! I figured it out using this information.

A thousand thanks to you and everyone who helped!
jomteon is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre, version 6.19.1 ERROR: Permission denied dunhill Calibre 7 06-06-2023 07:41 PM
Error 13 Permission denied for covers bookimp Calibre 2 07-21-2020 09:26 PM
Error: Permission Denied megthered Calibre 3 09-26-2015 11:51 AM
Permission denied error when adding book to library smei Library Management 7 09-16-2014 04:43 PM
Calibre 0.9.24 [64-bit] Permission Denied Error edwdecarlo Devices 6 03-23-2013 01:22 PM


All times are GMT -4. The time now is 04:23 PM.


MobileRead.com is a privately owned, operated and funded community.