se clean issue

35 views
Skip to first unread message

Weijia Cheng

unread,
Jun 21, 2021, 11:56:18 AM6/21/21
to Standard Ebooks

I seem to be getting errors when I try to target individual files with se clean. It looks like it's trying to parse xhtml files as CSS and CSS files as xhtml. In contrast running the directory-level clean looks fine. Here's a pastebin with verbose output: https://pastebin.com/QHxdLEJR

Vince

unread,
Jun 21, 2021, 1:40:31 PM6/21/21
to Standard Ebooks
Interesting. I didn’t even know clean could clean just a single file. :)

The problem is that there are two loops, one for html and one for css, but for single files, both are always run. For directories, the list of extensions on the loop is respected.

I’m not sure of the best way to fix that, or more correctly what way Alex would prefer, so I think I’ll leave it for him.

Also, I accidentally discovered that giving it a filename that doesn’t exist stack traces instead of pretty-printing.
Traceback (most recent call last):
  File "/usr/local/bin/se", line 33, in <module>
    sys.exit(load_entry_point('standardebooks', 'console_scripts', 'se')())
  File "/Users/vrice/setools/se/main.py", line 81, in main
    sys.exit(getattr(module, command_function)(args.plain_output))
  File "/Users/vrice/setools/se/commands/clean.py", line 30, in clean
    se.formatting.format_xml_file(filepath)
  File "/Users/vrice/setools/se/formatting.py", line 516, in format_xml_file
    with open(filename, "r+", encoding="utf-8") as file:
FileNotFoundError: [Errno 2] No such file or directory: '/Books/willa-cather_one-of-ours/src/epub/text/chapter-1.xhtml'
Reply all
Reply to author
Forward
0 new messages