Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-07-2025, 03:06 PM   #1
tobagotobago
Junior Member
tobagotobago began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2025
Device: kobo libra color
Conversion from txt file to epub (or anything else) fails

Hi,

After upgrading to Calibre 7.25 conversion of txt files to Epub (or any other format) does not work.

Downgrading to 7.24 fixes the problem.

Don't have the log file at the moment, I just know it ended with:

re.error: bad escape \u at position 14
tobagotobago is offline   Reply With Quote
Old 02-07-2025, 04:09 PM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 43,482
Karma: 165170834
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
For what it may be worth, I tried converting a text version of The Owl and the Pussy Cat poem to ePub using calibre 7.25. Regular expression error?

The conversion failed and the log file is in the spoiler.

Spoiler:
Code:
calibre, version 7.25.0 (win32, embedded-python: True)
Conversion error: Failed: Convert book 1 of 1 (The Owl and the Pussy-Cat)

Convert book 1 of 1 (The Owl and the Pussy-Cat)
Conversion options changed from defaults:
  output_profile: 'tablet'
  verbose: 2
  margin_right: 0.0
  margin_left: 0.0
  change_justification: 'left'
  margin_bottom: 0.0
  extra_css: 'body {\n-epub-hyphens: none;\nadobe-hyphenate: none;\n-webkit-hyphens: none;\n-moz-hyphens: none;\nhyphens: none;\n}'
  preserve_cover_aspect_ratio: True
  read_metadata_from_opf: 'C:\\Users\\dbowe\\AppData\\Local\\Temp\\calibre_64vjz1m8\\vjbflenm.opf'
  enable_heuristics: True
  margin_top: 0.0
Resolved conversion options
calibre version: 7.25.0
{'add_alt_text_to_img': False,
 'asciiize': False,
 'author_sort': None,
 'authors': None,
 'base_font_size': 0.0,
 'book_producer': None,
 'change_justification': 'left',
 'chapter': "//*[((name()='h1' or name()='h2') and re:test(., "
            "'\\s*((chapter|book|section|part)\\s+)|((prolog|prologue|epilogue)(\\s+|$))', "
            "'i')) or @class = 'chapter']",
 'chapter_mark': 'pagebreak',
 'comments': None,
 'cover': None,
 'debug_pipeline': None,
 'dehyphenate': True,
 'delete_blank_paragraphs': True,
 'disable_font_rescaling': False,
 'dont_split_on_page_breaks': False,
 'duplicate_links_in_toc': False,
 'embed_all_fonts': False,
 'embed_font_family': None,
 'enable_heuristics': True,
 'epub_flatten': False,
 'epub_inline_toc': False,
 'epub_max_image_size': 'none',
 'epub_toc_at_end': False,
 'epub_version': '2',
 'expand_css': False,
 'extra_css': 'body {\n'
              '-epub-hyphens: none;\n'
              'adobe-hyphenate: none;\n'
              '-webkit-hyphens: none;\n'
              '-moz-hyphens: none;\n'
              'hyphens: none;\n'
              '}',
 'extract_to': None,
 'filter_css': '',
 'fix_indents': True,
 'flow_size': 260,
 'font_size_mapping': None,
 'format_scene_breaks': True,
 'formatting_type': 'auto',
 'html_unwrap_factor': 0.4,
 'input_encoding': None,
 'input_profile': <calibre.customize.profiles.InputProfile object at 0x0000022712B5BE90>,
 'insert_blank_line': False,
 'insert_blank_line_size': 0.5,
 'insert_metadata': False,
 'isbn': None,
 'italicize_common_cases': True,
 'keep_ligatures': False,
 'language': None,
 'level1_toc': None,
 'level2_toc': None,
 'level3_toc': None,
 'line_height': 0.0,
 'linearize_tables': False,
 'margin_bottom': 0.0,
 'margin_left': 0.0,
 'margin_right': 0.0,
 'margin_top': 0.0,
 'markdown_extensions': 'footnotes, tables, toc',
 'markup_chapter_headings': True,
 'max_toc_links': 50,
 'minimum_line_height': 120.0,
 'no_chapters_in_toc': False,
 'no_default_epub_cover': False,
 'no_inline_navbars': False,
 'no_svg_cover': False,
 'output_profile': <calibre.customize.profiles.TabletOutput object at 0x0000022712B82E10>,
 'page_breaks_before': "//*[name()='h1' or name()='h2']",
 'paragraph_type': 'auto',
 'prefer_metadata_cover': False,
 'preserve_cover_aspect_ratio': True,
 'preserve_spaces': False,
 'pretty_print': True,
 'pubdate': None,
 'publisher': None,
 'rating': None,
 'read_metadata_from_opf': 'C:\\Users\\dbowe\\AppData\\Local\\Temp\\calibre_64vjz1m8\\vjbflenm.opf',
 'remove_fake_margins': True,
 'remove_first_image': False,
 'remove_paragraph_spacing': False,
 'remove_paragraph_spacing_indent_size': 1.5,
 'renumber_headings': True,
 'replace_scene_breaks': '',
 'search_replace': '[]',
 'series': None,
 'series_index': None,
 'smarten_punctuation': False,
 'sr1_replace': None,
 'sr1_search': None,
 'sr2_replace': None,
 'sr2_search': None,
 'sr3_replace': None,
 'sr3_search': None,
 'start_reading_at': None,
 'subset_embedded_fonts': False,
 'tags': None,
 'timestamp': None,
 'title': None,
 'title_sort': None,
 'toc_filter': None,
 'toc_threshold': 6,
 'toc_title': None,
 'transform_css_rules': '[]',
 'transform_html_rules': '[]',
 'txt_in_remove_indents': False,
 'unsmarten_punctuation': False,
 'unwrap_lines': True,
 'use_auto_toc': False,
 'verbose': 2}
InputFormatPlugin: TXT Input running
on C:\Users\dbowe\AppData\Local\Temp\calibre_64vjz1m8\ia710iic.txt
Reading text from file...
Detected input encoding as ascii with a confidence of 100%
Auto detected paragraph type as print
Auto detected formatting as heuristic
Running text through basic conversion...
Language not specified
Creator not specified
Building file list...
	Found files...
		 HTMLFile:0:a:'C:\\Users\\dbowe\\AppData\\Local\\Temp\\calibre_64vjz1m8\\1s9i1_l1_plumber\\index.html'
Normalizing filename cases
Rewriting HTML links
Parsing index.html ...
*********  Heuristic processing HTML  *********
There are 0 blank lines. 0.0 percent blank
minimum chapters required are: 1
found 0 pre-existing headings
Total wordcount is: 242, Average words per section is: 242, Marked up 0 chapters
Hard line breaks check returned True
Median line length is 45, calculated with html format
Fixing hyphenated content
Looking for more split points based on punctuation, currently have 0
Formatting scene breaks
Traceback (most recent call last):
  File "runpy.py", line 198, in _run_module_as_main
  File "runpy.py", line 88, 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\gui2\convert\gui_conversion.py", line 38, in gui_convert_override
  File "calibre\gui2\convert\gui_conversion.py", line 25, in gui_convert
  File "calibre\ebooks\conversion\plumber.py", line 1128, in run
  File "calibre\customize\conversion.py", line 242, in __call__
  File "calibre\ebooks\conversion\plugins\txt_input.py", line 325, in convert
  File "calibre\ebooks\conversion\plugins\html_input.py", line 109, in convert
  File "calibre\ebooks\conversion\plugins\html_input.py", line 209, in create_oebbook
  File "calibre\ebooks\oeb\base.py", line 1056, in data
  File "calibre\ebooks\oeb\base.py", line 966, in _parse_xhtml
  File "calibre\ebooks\oeb\parse_utils.py", line 203, in parse_html
  File "calibre\ebooks\conversion\preprocess.py", line 614, in __call__
  File "calibre\ebooks\conversion\utils.py", line 879, in __call__
  File "re\__init__.py", line 317, in _subx
  File "re\__init__.py", line 308, in _compile_repl
  File "re\_parser.py", line 1080, in parse_template
re.error: bad escape \u at position 14
DNSB is offline   Reply With Quote
Old 02-07-2025, 04:37 PM   #3
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,500
Karma: 29709834
Join Date: Mar 2012
Location: Sydney Australia
Device: none
↑ ↑ ↑ ✔

Same on an 8 line text file

BR
BetterRed is online now   Reply With Quote
Old 02-07-2025, 09:34 PM   #4
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,009
Karma: 27109258
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...d9606acad2855a
kovidgoyal is online now   Reply With Quote
Old 02-08-2025, 02:12 AM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 43,482
Karma: 165170834
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
No issues converting text to ePub after updating.
DNSB is offline   Reply With Quote
Old 02-08-2025, 03:49 AM   #6
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,516
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Same is happening to me with conversion from azw3 to epub, same problem?
Terisa de morgan is offline   Reply With Quote
Old 02-08-2025, 08:27 AM   #7
tobagotobago
Junior Member
tobagotobago began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jan 2025
Device: kobo libra color
Quote:
Originally Posted by kovidgoyal View Post
Thanks!

Are there any nightly builds available for Windows or do I have to build the binaries?
tobagotobago is offline   Reply With Quote
Old 02-08-2025, 08:46 AM   #8
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,269
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by tobagotobago View Post
Thanks!

Are there any nightly builds available for Windows or do I have to build the binaries?
See Setting up a calibre development environment. "Running from source" is easy.
chaley is offline   Reply With Quote
Old 02-08-2025, 09:04 AM   #9
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,543
Karma: 7096239
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by chaley View Post
See Setting up a calibre development environment. "Running from source" is easy.
Hi (again) @chaley

Calibre runs but throws an error for me using current source as of commit 2575737679c6b0eb73de2ece624775aa7b7d8865:

Spoiler:
calibre 7.25* embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.11.5
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre2\calibre-debug.exe
Successfully initialized third party plugins: [...]
Traceback (most recent call last):
File "C:\users\user\calibre-master\src\calibre\gui2\library\views.py", line 1733, in _debounce_book_display
File "C:\users\user\calibre-master\src\calibre\gui2\book_details.py", line 1542, in show_data
File "C:\users\user\calibre-master\src\calibre\gui2\book_details.py", line 1158, in show_data
File "C:\users\user\calibre-master\src\calibre\gui2\book_details.py", line 317, in render_html
File "C:\users\user\calibre-master\src\calibre\gui2\book_details.py", line 400, in render_data
File "C:\users\user\calibre-master\src\calibre\ebooks\metadata\book\render.py" , line 449, in mi_to_html
UnboundLocalError: cannot access local variable 'x' where it is not associated with a value

I know there's some new feature implementation ongoing at the moment and you're probably aware of this but I thought I should report just in case.
Comfy.n is online now   Reply With Quote
Old 02-08-2025, 09:15 AM   #10
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,269
Karma: 7955525
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Comfy.n View Post
Hi (again) @chaley

Calibre runs but throws an error for me using current source as of commit 2575737679c6b0eb73de2ece624775aa7b7d8865:

Spoiler:
calibre 7.25* embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.11.5
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre2\calibre-debug.exe
Successfully initialized third party plugins: [...]
Traceback (most recent call last):
File "C:\users\user\calibre-master\src\calibre\gui2\library\views.py", line 1733, in _debounce_book_display
File "C:\users\user\calibre-master\src\calibre\gui2\book_details.py", line 1542, in show_data
File "C:\users\user\calibre-master\src\calibre\gui2\book_details.py", line 1158, in show_data
File "C:\users\user\calibre-master\src\calibre\gui2\book_details.py", line 317, in render_html
File "C:\users\user\calibre-master\src\calibre\gui2\book_details.py", line 400, in render_data
File "C:\users\user\calibre-master\src\calibre\ebooks\metadata\book\render.py" , line 449, in mi_to_html
UnboundLocalError: cannot access local variable 'x' where it is not associated with a value

I know there's some new feature implementation ongoing at the moment and you're probably aware of this but I thought I should report just in case.
Report it as a bug so we can be sure Kovid sees it. I don't have time at the moment to chase it down.
chaley is offline   Reply With Quote
Old 02-08-2025, 09:31 AM   #11
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,543
Karma: 7096239
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by chaley View Post
Report it as a bug so we can be sure Kovid sees it. I don't have time at the moment to chase it down.
Done, thanks
Comfy.n is online now   Reply With Quote
Old 02-08-2025, 06:27 PM   #12
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,500
Karma: 29709834
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by tobagotobago View Post
Thanks!

Are there any nightly builds available for Windows or do I have to build the binaries?
It'll be in the next release which are normally every 2-3 weeks, and there are ==>> calibre friday preview releases

Simplest thing meantime is open your text file in a word processor, save it as DOCX and convert that.

BR
BetterRed is online now   Reply With Quote
Old 02-09-2025, 02:41 PM   #13
JohnnyBook
Groupie
JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.JohnnyBook holds these truths to be self-evident.
 
Posts: 187
Karma: 126824
Join Date: Dec 2008
Location: Out There
Device: K3 W/3G (Fixed screen!) & Paperwhite Wifi
Quote:
Originally Posted by BetterRed View Post
Simplest thing meantime is open your text file in a word processor, save it as DOCX and convert that.

BR
Thanks, I came to report the same problem. "re.error: bad escape \u at position 14"

And saw a fix was already implemented., but had no clue how to add the fix to my copy. (Github might as well be Greek to me, and I was not interested in "Setting up a calibre development environment.")

But switching the TXT file into a DOCX file and converting that, did the trick for me.
JohnnyBook is offline   Reply With Quote
Old 02-10-2025, 06:05 PM   #14
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 78,486
Karma: 142993688
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Terisa de morgan View Post
Same is happening to me with conversion from azw3 to epub, same problem?
Use KindleUnpack to go from KF8 > ePub.
JSWolf is offline   Reply With Quote
Reply

Tags
conversion

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion from pdf to txt yields (near) empty file jchwenger Conversion 3 07-07-2024 10:37 AM
Convert epub to TXT output encoding selection fails Shagbark Conversion 1 07-23-2015 12:07 PM
conversion to txt or rtf makes empty file lunixer Calibre 10 08-25-2010 04:56 PM
Newbie Question re txt File Conversion GJN Calibre 7 09-04-2009 07:40 AM


All times are GMT -4. The time now is 11:15 AM.


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