Building EPUB for Active Prelude to Calculus

59 views
Skip to first unread message

Bit Ranjit

unread,
Sep 7, 2023, 7:52:13 PM9/7/23
to PreTeXt support
My warm greetings, I'm trying to build an EPUB version of Active Prelude to Calculus however I'm encountering a lot of errors, after spending a whole day with it I got stuck at this part:

critical: [Errno 21] Is a directory: '/home/jj/prep/source/'
##################
Failed to build epub.  Exiting...

----------------------------------------------------
While running pretext, the following errors occured:

critical: [Errno 21] Is a directory: '/home/jj/prep/source/'
----------------------------------------------------
Exception ignored in atexit callback: <function exit_command at 0x7faea901cee0>
Traceback (most recent call last):
  File "/home/jj/.local/pipx/venvs/pretext/lib/python3.10/site-packages/pretext/utils.py", line 377, in exit_command
    sys.exit(1)
SystemExit: 1

Things I tried: looking at the utils.py code but all I could find was that line 377 is a functin that prints sys.exit, I couldn't find any more useful information from the pretextcli output. I've also tried to generate the EPUB using windows, but I got an entirely different error which was:
critical: 'charmap' codec can't decode byte 0x9d in position 262: character maps to <undefined> but I was also not able to figure out where and how the error was taking place.

I'm not sure which debug logs to include, please let me know which I should include.

Thank you.

Bit Ranjit

unread,
Sep 7, 2023, 7:54:04 PM9/7/23
to PreTeXt support
pretextlog.txt

Bit Ranjit

unread,
Sep 7, 2023, 8:09:39 PM9/7/23
to PreTeXt support
I also tried using the VSCode extension to build it and this is the output.
windowlog.txt

Rob Beezer

unread,
Sep 7, 2023, 8:15:46 PM9/7/23
to pretext...@googlegroups.com
There are many errors about images in WeBWorK problems. Unclear if these might
be generated from TikZ or not.

But the failure may be due to trying to construct a cover image automatically,
those seem to be more serious errors and closer to when it all comes crashing down.

Can you provide a cover image? Any image? Should be documented. That might get
you past the error for now.

I don't know if the Active Prelude book has ever been built as an EPUB.

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/de2e69c0-fd14-48b9-b4e8-4b99429db8dan%40googlegroups.com <https://groups.google.com/d/msgid/pretext-support/de2e69c0-fd14-48b9-b4e8-4b99429db8dan%40googlegroups.com?utm_medium=email&utm_source=footer>.

Bit Ranjit

unread,
Sep 7, 2023, 8:19:07 PM9/7/23
to PreTeXt support
Okay thanks! I'll try it right now. 

Yes, it does seem like they have never built an EPUB it seems but I really need wanted an EPUB version since I often don't have access to the internet.

Bit Ranjit

unread,
Sep 7, 2023, 11:12:26 PM9/7/23
to PreTeXt support
Unfortunately, still the same error code :(. I'm not too sure if I did it correctly though. 
I made a directory called cover and it has a file called cover.png
I then added an "<epub> <cover front=
cover/cover"/> </epub> on publication.


<publication>
  <source webwork-problems="../generated-assets/webwork/webwork-representations.xml">
    <directories external="../assets" generated="../generated-assets"
                 />
  </source>
<epub>
<cover front="cover/cover"/>
</epub>
  <html>
    <search google-cx="015103900096539427448:ngwuia10qci" />
    <css colors="blue_grey" />
    <!-- Examples and exercises are knowlized by default -->
    <!-- We disable this behavior  -->
    <knowl example="no" exercise-divisional="no" exercise-inline="no"
           />
  <baseurl href="https://activecalculus.org/prelude/" />
  </html>
  <latex sides="two" />
  <common>
    <!-- List Chapters and Sections in sidebar Table of Contents -->
    <tableofcontents level="2" />
    <exercise-divisional statement="yes" hint="no" answer="no" solution="no"/>
    <exercise-project statement="yes" hint="no" answer="no" solution="no" />
  </common>
  <webwork server="https://webwork-ptx.aimath.org" />
</publication>

Rob Beezer

unread,
Sep 8, 2023, 12:05:56 AM9/8/23
to pretext...@googlegroups.com
Late here, so just shooting in the dark.

Try putting ".png" onto the filename in the publication file.

And maybe the "cover" directory needs to be a subdirectory of "../assets" but less certain about this.

Bit Ranjit

unread,
Sep 8, 2023, 2:41:46 AM9/8/23
to PreTeXt support
So I tried doing both of those and also I looked up the 
"convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/421. convert-im6.q16: no images defined `/tmp/tmp64_fs0ll/cover.png' @ error/convert.c/ConvertImageCommand/3229" error and managed to solve it.

But I'm still getting the output:
This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2022/dev/Debian) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode

critical: [Errno 21] Is a directory: '/home/jj/prep/source/'
##################
Failed to build epub.  Exiting...

----------------------------------------------------
While running pretext, the following errors occured:

critical: [Errno 21] Is a directory: '/home/jj/prep/source/'
----------------------------------------------------
Exception ignored in atexit callback: <function exit_command at 0x7fd3b1d58ee0>

Traceback (most recent call last):
  File "/home/jj/.local/pipx/venvs/pretext/lib/python3.10/site-packages/pretext/utils.py", line 377, in exit_command
    sys.exit(1)
SystemExit: 1

Rob Beezer

unread,
Sep 8, 2023, 10:14:38 AM9/8/23
to pretext...@googlegroups.com

Bit Ranjit

unread,
Sep 10, 2023, 1:52:22 AM9/10/23
to PreTeXt support
Hello apologies for my late response I just had access to the internet. Thank you so much for your help unfortunately I have decided to give up in undertaking this task. I have just decided to settle for the local HTML builds. 
Again, my great thanks to all of you!

Rob Beezer

unread,
Sep 10, 2023, 1:42:52 PM9/10/23
to pretext...@googlegroups.com
Thanks, Bit, for all your work on this. I believe the presence of WeBWorK
problems producing images has not been considered in the EPUB conversion.
Leading to an unexpected failure.

I've put in a bit of (temporary) code to skip those images. I think there are
about 30 of these, judging from the number of validation errors.

I hope your internet is good enough to pick up:

https://pretextbook.org/beta/ac-prelude-epub-20230910/ac-prep.epub

If you can render it OK, it would be interesting to hear what reader you are
using. I can view it with Calibre on my desktop.

I'm going to start a thread about this on pretext-dev. You should be able to
read it publicly, and can request a membership if you want to contribute.

Sorry this was such trouble.

Rob

Bit Ranjit

unread,
Sep 16, 2023, 5:17:44 AM9/16/23
to PreTeXt support
Hello Rob, thank you so much, it works great!, I'm also using calibre, please let me know how I can contribute to this, I'd be really honored to contribute what I can.
Many thanks.
Reply all
Reply to author
Forward
0 new messages