Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows环境下的缓存锁死问题 #90

Closed
anartigone opened this issue Jul 17, 2023 · 4 comments
Closed

Windows环境下的缓存锁死问题 #90

anartigone opened this issue Jul 17, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@anartigone
Copy link

不勾选开启缓存会在输出时报错:

==============================
Time consuming: 0.0 minutes
翻译已完成。
==============================
开始转换电子书格式:
==============================
Converting XHTML to TXT...
TXT output written to C:\Users\ADMINI~1\AppData\Local\Temp\calibre__twf0xtj\po8vqv84.txt
Traceback (most recent call last):
  File "runpy.py", line 196, in _run_module_as_main
  File "runpy.py", line 86, in _run_code
  File "site.py", line 83, in <module>
  File "site.py", line 78, in main
  File "site.py", line 50, in run_entry_point
  File "calibre\utils\ipc\worker.py", line 215, in main
  File "calibre\utils\ipc\worker.py", line 150, in arbitrary_n
  File "calibre_plugins.ebook_translator.lib.conversion", line 108, in convert_book
  File "calibre_plugins.ebook_translator.lib.cache", line 220, in done
  File "calibre_plugins.ebook_translator.lib.cache", line 217, in destroy
PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\com.bookfere.Calibre.EbookTranslator\\temp\\0fd4e12aab5b93df53e937b476577b99.db'

勾选开启缓存后输出正常,但随后用缓存管理器删除/清除时会报错 (重启主程序后可以删除) :

calibre, version 6.23.0
错误: Cannot open file or folder as it is in use: <p>Could not open the file: "C:\Users\ADMINI~1\AppData\Local\Temp\com.bookfere.Calibre.EbookTranslator\cache\0fd4e12aab5b93df53e937b476577b99.db". It is already opened in the following programs:<div>The main calibre program: C:\Program Files\Calibre2\calibre.exe

calibre 6.23  embedded-python: True
Windows-10-10.0.17763-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.17763')
Python 3.10.1
Windows: ('10', '10.0.17763', 'SP0', 'Multiprocessor Free')
Interface language: zh_CN
Successfully initialized third party plugins: Ebook Translator (2, 1, 1)
Traceback (most recent call last):
  File "calibre_plugins.ebook_translator.cache", line 146, in clear
  File "calibre_plugins.ebook_translator.lib.cache", line 109, in clean
  File "calibre_plugins.ebook_translator.lib.cache", line 104, in remove
PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\com.bookfere.Calibre.EbookTranslator\\cache\\0fd4e12aab5b93df53e937b476577b99.db'

这个问题是在我进行词汇表测试时遇到的,已经尝试过更改默认缓存路径到自定义路径,情况没有变化、使用主程序最新版6.23也没有变化、使用管理员权限运行主程序也没有变化。
删除、清除、更改路径、重置路径都需要在新开主程序时,也就是没有使用过翻译功能的状态下才能成功操作。如果翻译过再进行操作就会触发上面的报错 (缓存锁死) 。

@bookfere bookfere added the bug Something isn't working label Aug 14, 2023
@bookfere
Copy link
Owner

刚在 Windows 系统下测试了一下,这个问题貌似修复了。你可以下载这个版本试试看:

ebook-translator-202308142121.zip

@anartigone
Copy link
Author

anartigone commented Aug 15, 2023

刚在 Windows 系统下测试了一下,这个问题貌似修复了。你可以下载这个版本试试看:

ebook-translator-202308142121.zip

测试了缓存管理,确认上次的问题已经修复。
同时发现了新的问题,就是在设置里勾选开启缓存一切正常,但是取消勾选后就会出现插件的高级模式界面锁死问题。无法进一步判断问题原因,主程序版本6.24,管理员权限运行。

操作流程A:

高级模式→翻译全部/所选→输出→正常

操作流程B:

高级模式→右上角关闭/Alt+F4→错误1 (报错并且无法退出插件界面,主程序可正常退出)

calibre, version 6.24.0
错误: 未处理的异常: <b>ProgrammingError</b>:Cannot operate on a closed database.

calibre 6.24  embedded-python: True
Windows-10-10.0.17763-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.17763')
Python 3.10.1
Windows: ('10', '10.0.17763', 'SP0', 'Multiprocessor Free')
Interface language: zh_CN
Successfully initialized third party plugins: Ebook Translator (2, 1, 1)
Traceback (most recent call last):
  File "calibre\gui2\main.py", line 461, in send_message
  File "calibre\gui2\listener.py", line 91, in send_message_in_process
OSError: Failed to connect to Listener at: \\.\pipe\CalibreGUI-Administratorx with error: QLocalSocket::connectToServer: Invalid name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre\gui2\main.py", line 465, in send_message
  File "calibre\gui2\listener.py", line 91, in send_message_in_process
OSError: Failed to connect to Listener at: \\.\pipe\CalibreGUI-Administratorx with error: QLocalSocket::connectToServer: Invalid name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre\gui2\main.py", line 556, in main
  File "calibre\gui2\main.py", line 569, in run_main
  File "calibre\gui2\main.py", line 502, in communicate
  File "calibre\gui2\main.py", line 470, in send_message
calibre.gui2.main.FailedToCommunicate: retrying

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre_plugins.ebook_translator.advanced", line 801, in done
  File "calibre_plugins.ebook_translator.lib.cache", line 217, in destroy
  File "calibre_plugins.ebook_translator.lib.cache", line 213, in close
sqlite3.ProgrammingError: Cannot operate on a closed database.

操作流程C:

高级模式→右上角关闭/Alt+F4→错误1→翻译全部/所选→错误2

calibre, version 6.24.0
错误: 未处理的异常: <b>RuntimeError</b>:wrapped C/C++ object of type TranslationWorker has been deleted

calibre 6.24  embedded-python: True
Windows-10-10.0.17763-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.17763')
Python 3.10.1
Windows: ('10', '10.0.17763', 'SP0', 'Multiprocessor Free')
Interface language: zh_CN
Successfully initialized third party plugins: Ebook Translator (2, 1, 1)
Traceback (most recent call last):
  File "calibre\gui2\main.py", line 461, in send_message
  File "calibre\gui2\listener.py", line 91, in send_message_in_process
OSError: Failed to connect to Listener at: \\.\pipe\CalibreGUI-Administratorx with error: QLocalSocket::connectToServer: Invalid name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre\gui2\main.py", line 465, in send_message
  File "calibre\gui2\listener.py", line 91, in send_message_in_process
OSError: Failed to connect to Listener at: \\.\pipe\CalibreGUI-Administratorx with error: QLocalSocket::connectToServer: Invalid name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre\gui2\main.py", line 556, in main
  File "calibre\gui2\main.py", line 569, in run_main
  File "calibre\gui2\main.py", line 502, in communicate
  File "calibre\gui2\main.py", line 470, in send_message
calibre.gui2.main.FailedToCommunicate: retrying

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre_plugins.ebook_translator.advanced", line 760, in translate_all_paragraphs
RuntimeError: wrapped C/C++ object of type TranslationWorker has been deleted

@bookfere
Copy link
Owner

试试这个版本:

ebook-translator-202308172008.zip

@anartigone
Copy link
Author

试试这个版本:

ebook-translator-202308172008.zip

完美解决,太棒了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants