Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-27-2023, 09:22 AM   #1
docjc
Member
docjc began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Aug 2020
Device: Kobo
question regarding ebook-comversion command line switches

Hi,
I'm using the ebook-converter.exe as an external program in a python project and I would like to avoid the cmd output of the program but I don't find any switch to avoid these messages. Is there any switch that surpresses these messages?

docjc is offline   Reply With Quote
Old 02-27-2023, 10:53 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,347
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No there isnt. Redirect the command output to null
kovidgoyal is offline   Reply With Quote
Advert
Old 02-28-2023, 04:58 AM   #3
docjc
Member
docjc began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Aug 2020
Device: Kobo
thank you for the quick answer, your hint I already tried with a strange result:
on the w11 command line the following command worked fine:
ebook-convert "file 1.epub " "tmp.epub" >nul
exactly the same command just copied from python program gives the following result:
"Extra arguments not understood: >nul" and no conversion. Strange.
docjc is offline   Reply With Quote
Old 02-28-2023, 06:16 AM   #4
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,025
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Try > nul (a space)

Also some windows programs output to stderr, so you need 2> nul instead.
Quoth is offline   Reply With Quote
Old 02-28-2023, 10:25 AM   #5
docjc
Member
docjc began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Aug 2020
Device: Kobo
thanks for your answer, but...
this is the line
subprocess.run("ebook-convert " + "\"file 1.epub\" " + "\"tmp.epub\" " + "> nul")

This is the result:
"Extra arguments not understood: >, nul" (of course no conversion) btw where does to comma come from?
Any hint?

Where does the comma come from???
docjc is offline   Reply With Quote
Advert
Old 02-28-2023, 10:34 AM   #6
Sarmat89
Fanatic
Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.Sarmat89 ought to be getting tired of karma fortunes by now.
 
Posts: 517
Karma: 2268308
Join Date: Nov 2015
Device: none
You need shell=True (or just use subprocess.DEVNULL for the stdout)
Sarmat89 is offline   Reply With Quote
Old 02-28-2023, 10:46 AM   #7
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by docjc View Post
thanks for your answer, but...
this is the line
subprocess.run("ebook-convert " + "\"file 1.epub\" " + "\"tmp.epub\" " + "> nul")

This is the result:
"Extra arguments not understood: >, nul" (of course no conversion) btw where does to comma come from?
Any hint?

Where does the comma come from???
subprocess.run() is not a shell. You specify arguments, stdin, stdout, and stdout as separate parameters. See the documentation, and especially the Frequently used arguments section. From what you say I think you want stdout=DEVNULL and stderr=DEVNULL.

IMO: supplying the arguments as a python list is a lot easier than passing them as a string with all the quotes and escaping.
chaley is offline   Reply With Quote
Old 02-28-2023, 12:51 PM   #8
docjc
Member
docjc began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Aug 2020
Device: Kobo
@Sarmat89 and Chaley
Thank you very much, now the problem is solved
For a newbee in python as me it is sometimes difficult
docjc is offline   Reply With Quote
Old 02-28-2023, 04:53 PM   #9
Quoth
Still reading
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 14,025
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
Quote:
Originally Posted by docjc View Post
thanks for your answer, but...
this is the line
subprocess.run(
That was a very vital bit of info! Not a regular command line.
Quoth is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
search question gui vs command line keyser666 Calibre 1 04-21-2017 11:20 AM
Hyphenate your ebook files from the command line acabal Workshop 9 10-05-2016 03:13 AM
Using ebook-editor in command line Francois_C Editor 12 04-17-2015 10:17 AM
Command line ebook viewer? anoved Reading and Management 1 02-13-2012 02:32 PM
calibredb command line question (setting metadata) mezme Calibre 0 12-06-2011 12:17 AM


All times are GMT -4. The time now is 12:47 AM.


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