Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 02-08-2021, 05:32 AM   #1
kruprecht
Junior Member
kruprecht began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2019
Device: tolino
AttributeError: module 'sys' has no attribute 'extensions_location'

I'm tryin to use Calibre in a Python Telegram bot and have already included calibre.utils.icu in this manner
Quote:
from calibre.utils.icu import sort_key
But I'm getting this error:
Quote:
Traceback (most recent call last):
File "c:\dev\Python\calibre-connect.py", line 21, in <module>
from calibre.utils.icu import sort_key
File "C:\Program Files\Calibre2\calibre\src\calibre\__init__.py", line 19, in <module>
from calibre.constants import (iswindows, ismacos, islinux, isfrozen,
File "C:\Program Files\Calibre2\calibre\src\calibre\constants.py", line 168, in <module>
plugins_loc = sys.extensions_location
AttributeError: module 'sys' has no attribute 'extensions_location'
Any ideas?
THX
kruprecht is offline   Reply With Quote
Old 02-08-2021, 06:01 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You cant really use calibre code in external python interpreters, except on linux, if you install calibre system-wide. On windows, if you want to use calibre use calibre-debug as the python interpreter.

calibre-debug file.py

https://manual.calibre-ebook.com/dev...on-environment
kovidgoyal is offline   Reply With Quote
Advert
Old 02-08-2021, 06:09 AM   #3
kruprecht
Junior Member
kruprecht began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2019
Device: tolino
Thank you for the quick response - do you know a python package that allows easily searching the Calibre-DB?
kruprecht is offline   Reply With Quote
Old 02-08-2021, 06:40 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,444
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kruprecht View Post
Thank you for the quick response - do you know a python package that allows easily searching the Calibre-DB?
Calibre itself. See https://manual.calibre-ebook.com/dev...rts-of-calibre.

If for some reason you can't do that then use raw SQL with sqlite. Be aware that calibre uses locally defined triggers so some read queries will fail, and will most write queries.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
AttributeError: 'NoneType' object has no attribute 'data' koyahinipo@hurif Conversion 2 08-09-2018 10:01 PM
Running Calibre CLI module, SYS arguments? tsar2512 Development 6 02-06-2018 12:05 PM
Please help - AttributeError: 'NoneType' object has no attribute 'lower' Sazzaroo Calibre 9 12-11-2015 10:22 AM
AttributeError: 'NoneType' object has no attribute 'split' Thalia Helikon Conversion 1 12-30-2012 08:09 AM
AttributeError: 'NoneType' object has no attribute 'lower manada Calibre 2 08-10-2010 10:54 PM


All times are GMT -4. The time now is 06:08 AM.


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