xxyzz / WordDumb

A calibre plugin that generates Kindle Word Wise and X-Ray files for KFX, AZW3, MOBI and EPUB eBook.
https://xxyzz.github.io/WordDumb/
GNU General Public License v3.0
386 stars 19 forks source link

AttributeError: 'str' object has no attribute 'fomat' #81

Closed kingsiham closed 2 years ago

kingsiham commented 2 years ago

Describe the bug

calibre, version 6.7.1 错误: 未处理的异常: AttributeError:'str' object has no attribute 'fomat'

calibre 6.7.1 embedded-python: True Windows-10-10.0.19041-SP0 Windows ('64bit', 'WindowsPE') ('Windows', '10', '10.0.19041') Python 3.10.1 Windows: ('10', '10.0.19041', 'SP0', 'Multiprocessor Free') Interface language: zh_CN Successfully initialized third party plugins: WordDumb (3, 26, 0) Traceback (most recent call last): File "calibre\gui2__init__.py", line 717, in dispatch File "calibre_plugins.worddumb.ui", line 135, in done File "calibre_plugins.worddumb.error_dialogs", line 57, in job_failed File "calibre_plugins.worddumb.error_dialogs", line 107, in check_network_error AttributeError: 'str' object has no attribute 'fomat'

System Information

OS: Windows 10, x64 calibre version: 6.7.1 Python version: 3.11.0 Plugin version: 3.26.0

Error message

Starting job: 正在为《The Consumer Society (Published in association with Theory, Culture & Society)》生成生词提示和X-Ray 
Job: "正在为《The Consumer Society (Published in association with Theory, Culture & Society)》生成生词提示和X-Ray" failed with error: 
Traceback (most recent call last):
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\urllib3\connectionpool.py", line 700, in urlopen
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\urllib3\connectionpool.py", line 996, in _prepare_proxy
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\urllib3\connection.py", line 364, in connect
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\urllib3\connection.py", line 499, in _connect_tls_proxy
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
  File "ssl.py", line 512, in wrap_socket
  File "ssl.py", line 1070, in _create
  File "ssl.py", line 1341, in do_handshake
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\requests\adapters.py", line 489, in send
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\urllib3\connectionpool.py", line 787, in urlopen
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\urllib3\util\retry.py", line 592, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='en.wikipedia.org', port=443): Max retries exceeded with url: /w/api.php?format=json&action=query&prop=extracts%7Cpageprops&exintro=1&explaintext=1&redirects=1&exsentences=7&formatversion=2&ppprop=wikibase_item&titles=Consumer+Society%7CCulture+%26+Society%7CSAGE+Publications+Ltd%7C1+Oliver%E2%80%99s+Yard%7CCity+Road%7CLondon%7CThousand+Oaks%7CCalifornia%7CMathura+Road%7CNew+Delhi%7CSamsung+Hub%7CSingapore%7CFrench%7CMinistry+of+Culture%7CCopyright+Licensing+Agency%7CBritish+Library+Cataloguing%7CPublication%7CChennai%7CIndia%7CUnderground (Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy', SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)'))))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "calibre\gui2\threaded_jobs.py", line 82, in start_work
  File "calibre_plugins.worddumb.parse_job", line 154, in do_job
  File "calibre_plugins.worddumb.parse_job", line 287, in create_files
  File "calibre_plugins.worddumb.x_ray", line 169, in finish
  File "calibre_plugins.worddumb.mediawiki", line 286, in query_mediawiki
  File "calibre_plugins.worddumb.mediawiki", line 134, in query
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\requests\sessions.py", line 600, in get
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\requests\sessions.py", line 587, in request
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\requests\sessions.py", line 701, in send
  File "C:\Users\kingsiham\AppData\Roaming\calibre\plugins\worddumb-libs-py3.10\requests\adapters.py", line 559, in send
requests.exceptions.ProxyError: HTTPSConnectionPool(host='en.wikipedia.org', port=443): Max retries exceeded with url: /w/api.php?format=json&action=query&prop=extracts%7Cpageprops&exintro=1&explaintext=1&redirects=1&exsentences=7&formatversion=2&ppprop=wikibase_item&titles=Consumer+Society%7CCulture+%26+Society%7CSAGE+Publications+Ltd%7C1+Oliver%E2%80%99s+Yard%7CCity+Road%7CLondon%7CThousand+Oaks%7CCalifornia%7CMathura+Road%7CNew+Delhi%7CSamsung+Hub%7CSingapore%7CFrench%7CMinistry+of+Culture%7CCopyright+Licensing+Agency%7CBritish+Library+Cataloguing%7CPublication%7CChennai%7CIndia%7CUnderground (Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy', SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)'))))

Called with args: ((8, 'MOBI', 'C:\\Users\\kingsiham\\Documents\\Calibre Library\\Jean Baudrillard\\The Consumer Society (Published in a (8)\\The Consumer Society (Published - Jean Baudrillard.mobi', , {'spacy': 'en_core_web_', 'wiki': 'en', 'kaikki': 'English', 'gloss': True}), True, True) {'notifications': , 'abort': , 'log': }

Reproduce steps

1.run wordDumb 2.error occurred

Screenshots or videos

No response

xxyzz commented 2 years ago

This typo is fixed in https://github.com/xxyzz/WordDumb/commit/1ad184bb38c15066ad95a05cf88e87fb50cc8d43.

The fundamental error is the plugin can't connect to Wikipedia API.

kingsiham commented 2 years ago

‘The plugin in 'C:\Users\kings\Downloads\WordDumb-master.zip' is invalid. It does not contain a top-level init.py file’

I want to use the latest version, but it can't be loaded.

xxyzz commented 2 years ago

You could download the zip file from GitHub Actions Artifacts: https://github.com/xxyzz/WordDumb/actions/runs/3327629277

kingsiham commented 2 years ago

got it. thanks bro~

xxyzz commented 2 years ago

The fix was released in version 3.26.1, close the issue now.