|  02-26-2024, 03:22 AM | #1 | 
| Junior Member  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'
 Code: set CALIBRE_TEMP_DIR=D:\Software\calibre_temp\Temporary\Calibre\temp I'm completely unsure how to move forward. Any help would be greatly appreciated. | 
|   |   | 
|  02-26-2024, 03:35 AM | #2 | 
| null operator (he/him)            Posts: 22,010 Karma: 30277294 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 | 
|   |   | 
|  02-26-2024, 04:43 AM | #3 | 
| Junior Member  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. | 
|   |   | 
|  02-26-2024, 04:57 AM | #4 | 
| Zealot            Posts: 142 Karma: 642206 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. | 
|   |   | 
|  02-26-2024, 05:03 AM | #5 | 
| null operator (he/him)            Posts: 22,010 Karma: 30277294 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 | 
|   |   | 
|  02-26-2024, 05:09 AM | #6 | 
| Resident Curmudgeon            Posts: 80,727 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | 
			
			I've been using the Windows default temp directory ever since calibre was libprs500 and I've had no problem.
		 | 
|   |   | 
|  02-26-2024, 05:18 AM | #7 | |
| Junior Member  Posts: 8 Karma: 10 Join Date: Feb 2024 Device: none | Quote: 
 | |
|   |   | 
|  02-26-2024, 05:20 AM | #8 | 
| Junior Member  Posts: 8 Karma: 10 Join Date: Feb 2024 Device: none | 
			
			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
		 | 
|   |   | 
|  02-26-2024, 05:22 AM | #9 | 
| Junior Member  Posts: 8 Karma: 10 Join Date: Feb 2024 Device: none | |
|   |   | 
|  02-26-2024, 05:34 AM | #10 | 
| Zealot            Posts: 142 Karma: 642206 Join Date: Mar 2021 Device: Kindle Voyage | 
			
			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.
		 | 
|   |   | 
|  02-26-2024, 05:34 AM | #11 | |
| Junior Member  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: 
 | |
|   |   | 
|  02-26-2024, 05:47 AM | #12 | 
| Junior Member  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 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 | 
|   |   | 
|  02-26-2024, 06:03 AM | #13 | |
| Zealot            Posts: 142 Karma: 642206 Join Date: Mar 2021 Device: Kindle Voyage | Quote: 
 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. | |
|   |   | 
|  02-26-2024, 06:09 AM | #14 | |
| Zealot            Posts: 142 Karma: 642206 Join Date: Mar 2021 Device: Kindle Voyage | Quote: 
 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 | |
|   |   | 
|  02-26-2024, 08:29 AM | #15 | |
| Junior Member  Posts: 8 Karma: 10 Join Date: Feb 2024 Device: none | Quote: 
 A thousand thanks to you and everyone who helped! | |
|   |   | 
|  | 
| Thread Tools | Search this Thread | 
| 
 | 
|  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 |