Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-05-2022, 11:07 PM   #31
lizzie1170
Member
lizzie1170 began at the beginning.
 
lizzie1170's Avatar
 
Posts: 12
Karma: 10
Join Date: Jul 2022
Device: none
Quote:
Originally Posted by capink View Post
It is working for me without producing this error. I am currently on Linux and do not have an access to Windows machine. Maybe it has something to do the OS. Try the one attached below and see whether it makes a difference. Beyond that, I'm afraid I cannot help.
I know that I insist too much, but the result is already very close. I run the code in debug mode.

Code:
"ebook-convert" is not recognized as an internal or external command, operable program or batch file.
Traceback (most recent call last):
  File "calibre_plugins.action_chains.chains", line 182, in _run_loop
  File "calibre_plugins.action_chains.actions.code", line 130, in run
  File "module", line 46, in run
  File "module", line 20, in tags_from_epub
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\XXXXXXXX\\AppData\\Local\\Temp\\tmpocxcipyw\\temp.txt'
Perhaps there may be a clue here.
lizzie1170 is offline   Reply With Quote
Old 09-06-2022, 03:07 AM   #32
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: 21,722
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by lizzie1170 View Post
I know that I insist too much, but the result is already very close. I run the code in debug mode.

Code:
"ebook-convert" is not recognized as an internal or external command, operable program or batch file.
Traceback (most recent call last):
  File "calibre_plugins.action_chains.chains", line 182, in _run_loop
  File "calibre_plugins.action_chains.actions.code", line 130, in run
  File "module", line 46, in run
  File "module", line 20, in tags_from_epub
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\XXXXXXXX\\AppData\\Local\\Temp\\tmpocxcipyw\\temp.txt'
Perhaps there may be a clue here.
Perhaps it's in plain sight: whatever is creating that file path I've highlighted isn't conformant with where the Windows Temp folder is normally located. The default location is C:\Users\<username>\AppData\Local\Temp where <username> is the Windows login name (e.g. Joe Blow, Jane Doe, etc).

BR
BetterRed is offline   Reply With Quote
Old 09-06-2022, 09:13 AM   #33
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Another semi-automatic solution for you to get around this error:
  • Choose all the books you want, and use calibre gui to convert to text.
  • Modify the Action Chain code to use the text file created by calibre conversion. (I can help with that if you don't know to do it)
  • Delete all the converted text files using calibre's "remove format" option.

Edit: You can make a chain of all the above steps. Make sure to check the option to wait for ongoing jobs in the "Calibre Actions" settings dialog.

Edit2: Chain attached below.

There are two things to take into consideration while using this chain
  • The chain is interactive because the convert step will pop up a dialog asking you for input. Make sure you select the output format to be text.
  • Warning: that this chain will delete all (selected) text formats even pre-exsiting ones. If you don't want this remove the last action from the chain and manually delete the text files instead

Edit3: For anyone else who wants to test this, you must make a dictionary of tags and corresponding regular expressions in the format illustrated below (This is the format chosen by OP in his original code).

Code:
{
    "case_sensitive_tag": "case_sensitive_tag",
    "science-fiction": "(?i)science.?fiction",
    "non-fiction": "(?i)non.?fiction"
}
The location of dictionary is controlled by a variable in the first action withing the chain. You have to change the variable to the location of your dictionary.
Attached Files
File Type: zip extract_tags_2.zip (1.2 KB, 64 views)

Last edited by capink; 09-06-2022 at 04:46 PM.
capink is offline   Reply With Quote
Old 09-07-2022, 01:48 PM   #34
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by lizzie1170 View Post
I know that I insist too much, but the result is already very close. I run the code in debug mode.

Code:
"ebook-convert" is not recognized as an internal or external command, operable program or batch file.
Traceback (most recent call last):
  File "calibre_plugins.action_chains.chains", line 182, in _run_loop
  File "calibre_plugins.action_chains.actions.code", line 130, in run
  File "module", line 46, in run
  File "module", line 20, in tags_from_epub
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\XXXXXXXX\\AppData\\Local\\Temp\\tmpocxcipyw\\temp.txt'
Perhaps there may be a clue here.
Yes. The clue is right there. I don't know why your system does not have ebook-convert, while having calibre installed.

Edit: Now the I think about it maybe Windows use a different name for the command line tools e.g. ebook-convert.exe. Maybe someone can confirm this. If so, I can modify the first chain which is better than the second IMO.

Last edited by capink; 09-07-2022 at 01:54 PM.
capink is offline   Reply With Quote
Old 09-07-2022, 05:33 PM   #35
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: 21,722
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by capink View Post
Yes. The clue is right there. I don't know why your system does not have ebook-convert, while having calibre installed.

Edit: Now the I think about it maybe Windows use a different name for the command line tools e.g. ebook-convert.exe. Maybe someone can confirm this. If so, I can modify the first chain which is better than the second IMO.
Here's what's in the Windows default install location
Code:
directories
C:\Program Files\Calibre2\app

files
C:\Program Files\Calibre2\calibre-complete.exe
C:\Program Files\Calibre2\calibre-customize.exe
C:\Program Files\Calibre2\calibre-debug.exe
C:\Program Files\Calibre2\calibre-parallel.exe
C:\Program Files\Calibre2\calibre-server.exe
C:\Program Files\Calibre2\calibre-smtp.exe
C:\Program Files\Calibre2\calibre.exe
C:\Program Files\Calibre2\calibredb.exe
C:\Program Files\Calibre2\ebook-convert.exe
C:\Program Files\Calibre2\ebook-device.exe
C:\Program Files\Calibre2\ebook-edit.exe
C:\Program Files\Calibre2\ebook-meta.exe
C:\Program Files\Calibre2\ebook-polish.exe
C:\Program Files\Calibre2\ebook-viewer.exe
C:\Program Files\Calibre2\fetch-ebook-metadata.exe
C:\Program Files\Calibre2\LICENSE
C:\Program Files\Calibre2\lrf2lrs.exe
C:\Program Files\Calibre2\lrfviewer.exe
C:\Program Files\Calibre2\lrs2lrf.exe
C:\Program Files\Calibre2\markdown-calibre.exe
C:\Program Files\Calibre2\web2disk.exe

And I still doubt that the path in the FileNotFoundError is 'real' - unless someone/something has created it manually i.e.
  • a directory named XXXXXXXXX at he root of the C: drive,
  • within that a directory named AppData,
  • within that a directory named Local,
  • within that a directory named Temp
OR
  • a Symbolic Link named XXXXXXXX at the root of C: that references a directory within the Windows created C:\Users directory.

To me at least, they both seem unlikely.

BR

Last edited by BetterRed; 09-07-2022 at 05:46 PM.
BetterRed is offline   Reply With Quote
Old 09-07-2022, 06:05 PM   #36
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by BetterRed View Post
Here's what's in the Windows default install location
Thanks for the exhaustive list of commands. Should be useful for future reference.

Quote:
Originally Posted by BetterRed View Post
And I still doubt that the path in the FileNotFoundError is 'real' - unless someone/something has created it manually i.e.
  • a directory named XXXXXXXXX at he root of the C: drive,
  • within that a directory named AppData,
  • within that a directory named Local,
  • within that a directory named Temp
OR
  • a Symbolic Link named XXXXXXXX at the root of C: that references a directory within the Windows created C:\Users directory.

BR
I share your view that the temporary directory location seems odd. But lizzie1170 indicated in a previous post the directory was created but was missing the converted temp.txt file, which is consistent with the ebook-convert error.

So, I modified the first chain and attached it to this post. Note that you need to remove the old chain first to be able to import the modified version (because of name clashes).
Attached Files
File Type: zip extract_tags.zip (1.3 KB, 64 views)

Last edited by capink; 09-08-2022 at 12:36 PM.
capink is offline   Reply With Quote
Old 09-07-2022, 06:42 PM   #37
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: 21,722
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@capink - I don't have the AC PI installed, so I can't test any chains.

BR
BetterRed is offline   Reply With Quote
Old 09-07-2022, 06:58 PM   #38
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Yes I know. The last sentence was not directed to you.
capink is offline   Reply With Quote
Old 09-08-2022, 03:20 AM   #39
lizzie1170
Member
lizzie1170 began at the beginning.
 
lizzie1170's Avatar
 
Posts: 12
Karma: 10
Join Date: Jul 2022
Device: none
Quote:
Originally Posted by capink View Post
Thanks for the exhaustive list of commands. Should be useful for future reference.
I share your view that the temporary directory location seems odd. But lizzie1170 indicated in a previous post the directory was created but was missing the converted temp.txt file, which is consistent with the ebook-convert error.

So, I modified the first chain and attached it to this post. Note that you need to remove the old chain first to be able to import the modified version (because of name clashes).
I imported the latest code. I have the portable version on an external hard drive, I found that ebook-convert is located at:
D:\User\Calibre Portable\Calibre\ebook-convert.exe

I edited this path in the code.
converter = 'D:\USER\Calibre Portable\Calibre\ebook-convert.exe'

I got the same error:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\USER\\AppData\\Local\\Temp\\tmp_mmjtpdw\\temp .txt'

Maybe it's because of the paths I've set for the environment variables?
** CALIBRE_CONFIG_DIRECTORY = D:\USER\Calibre Portable\Calibre Settings
** CALIBRE_DEVELOP_FROM = D:\USER\Calibre Portable\calibre-6.3.0\src
** CALIBRE_TEMP_DIR = C:\USER\AppData\Local\Temp

When I ran debug mode.
"D:\User\Calibre" is not recognized as an internal or external command, operable program or batch file.
Traceback (most recent call last):
File "calibre_plugins.action_chains.chains", line 182, in _run_loop
File "calibre_plugins.action_chains.actions.code", line 130, in run
File "module", line 49, in run
File "module", line 29, in tags_from_epub

Maybe it's the path to ebook-convert?
Attached Thumbnails
Click image for larger version

Name:	res_code_2.png
Views:	78
Size:	37.7 KB
ID:	196373   Click image for larger version

Name:	res_code_2.1.PNG
Views:	68
Size:	19.9 KB
ID:	196376  
lizzie1170 is offline   Reply With Quote
Old 09-08-2022, 05:21 AM   #40
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
I cannot debug anything happening on Windows because I do not have access. If the latest update is not working for you, use the solution posted in the post two posts before it. If that doesn't work, you are out of luck.
capink is offline   Reply With Quote
Old 09-08-2022, 02:00 PM   #41
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,048
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by lizzie1170 View Post
I imported the latest code. I have the portable version on an external hard drive, I found that ebook-convert is located at:
D:\User\Calibre Portable\Calibre\ebook-convert.exe

I edited this path in the code.
converter = 'D:\USER\Calibre Portable\Calibre\ebook-convert.exe'

I got the same error:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\USER\\AppData\\Local\\Temp\\tmp_mmjtpdw\\temp .txt'

Maybe it's because of the paths I've set for the environment variables?
** CALIBRE_CONFIG_DIRECTORY = "D:\USER\Calibre Portable\Calibre Settings"
** CALIBRE_DEVELOP_FROM = D:\USER\Calibre Portable\calibre-6.3.0\src
** CALIBRE_TEMP_DIR = C:\USER\AppData\Local\Temp

When I ran debug mode.
"D:\User\Calibre" is not recognized as an internal or external command, operable program or batch file.
Traceback (most recent call last):
File "calibre_plugins.action_chains.chains", line 182, in _run_loop
File "calibre_plugins.action_chains.actions.code", line 130, in run
File "module", line 49, in run
File "module", line 29, in tags_from_epub

Maybe it's the path to ebook-convert?
You need to quote any path that contains spaces
theducks is online now   Reply With Quote
Old 09-08-2022, 06:10 PM   #42
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: 21,722
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by lizzie1170 View Post
. . .
Maybe it's because of the paths I've set for the environment variables?
** CALIBRE_CONFIG_DIRECTORY = D:\USER\Calibre Portable\Calibre Settings
** CALIBRE_DEVELOP_FROM = D:\USER\Calibre Portable\calibre-6.3.0\src
** CALIBRE_TEMP_DIR = C:\USER\AppData\Local\Temp
The CALIBRE_CONFIG_DIRECTORY and CALIBRE_TEMP_DIR environment variable settings would appear to be overriding the very basis for Calibre Portable's existence - which is to be self contained and thus portable.

What is your rationale for using them?

I can't speak to CALIBRE_DEVELOP_FROM as I've only used it with the installed version of calibre, and that was a decade ago.

BR
BetterRed is offline   Reply With Quote
Old 09-11-2022, 12:50 AM   #43
lizzie1170
Member
lizzie1170 began at the beginning.
 
lizzie1170's Avatar
 
Posts: 12
Karma: 10
Join Date: Jul 2022
Device: none
Quote:
Originally Posted by capink View Post
Another semi-automatic solution for you to get around this error:
  • Choose all the books you want, and use calibre gui to convert to text.
  • Modify the Action Chain code to use the text file created by calibre conversion. (I can help with that if you don't know to do it)
  • Delete all the converted text files using calibre's "remove format" option.

Edit: You can make a chain of all the above steps. Make sure to check the option to wait for ongoing jobs in the "Calibre Actions" settings dialog.

Edit2: Chain attached below.

Edit3: For anyone else who wants to test this, you must make a dictionary of tags and corresponding regular expressions in the format illustrated below (This is the format chosen by OP in his original code).
I am very happy, because the code executed perfectly. Thank you very much for the dedication this must be the best in text search, it is a dream come true.

I got excited and loaded over 1000 books in one task and my computer restarted so I only run the code on groups of 50 books. Do you think that an EVENT can be created with which the code can be executed automatically, even one by one?
Attached Thumbnails
Click image for larger version

Name:	ft_ig1.PNG
Views:	63
Size:	29.7 KB
ID:	196431   Click image for larger version

Name:	ft_ig2.PNG
Views:	63
Size:	48.3 KB
ID:	196432   Click image for larger version

Name:	ft_ig3.PNG
Views:	59
Size:	2.1 KB
ID:	196433  
lizzie1170 is offline   Reply With Quote
Old 09-11-2022, 08:59 PM   #44
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,196
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by lizzie1170 View Post
Do you think that an EVENT can be created with which the code can be executed automatically, even one by one?
I have been thinking of adding something like what you suggest to the plugin, but never got around to actually do it. I have not settled on what is the best way to go about this, and don't have time right now.

Anyway, it does not make sense in your case, because the chain is interactive, so the conversion settings dialog will keep popping up with every iteration.
capink is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I bulk-delete a number of selected tags from all books in my library? droopy Library Management 1 08-09-2020 06:24 PM
How are tags selected between multiple metadata sources? Isomorpheus Library Management 3 10-19-2019 01:29 PM
HTML Metadata add Tags? skb Conversion 5 07-16-2019 07:24 AM
Help Please- Add and Convert Books and Download Metadata not working??? gorgeousbird Calibre 5 08-14-2012 12:31 AM
ADD Books & extract tags from title? johnb0647 Calibre 3 01-08-2011 05:36 PM


All times are GMT -4. The time now is 06:27 PM.


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