Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Settings from ZIP archive - with custom .py script #917

Open
klassenjm opened this issue Oct 27, 2023 · 2 comments
Open

Import Settings from ZIP archive - with custom .py script #917

klassenjm opened this issue Oct 27, 2023 · 2 comments
Assignees
Labels
bug This is a step backwards priority We want to fix this before next major release Python This issue needs work on the Python code, no XeTeX involved.

Comments

@klassenjm
Copy link

I would like to be able to supply a prepared configuration for study Bible 'notes only' printing. I can mostly do this by sharing a PDF with a saved configuration, and providing instructions to load a configuration from this PDF.

However, a part of this solution working is a small Python script. Although loading the config from the PDF sets the "Process Text With Custom Script at:" switch, it does not actually point to a valid location for the project the config is being set for -- nor does it copy the Python script into place (I'm aware that the PDF file is not storing the script).

I thought maybe loading the config from a saved archived would work. However, when I try this PTXPrint complains of an "Invalid PDF header"

Traceback (most recent call last):
  File "ptxprint\gtkview.py", line 3722, in onSelectPDForZIPfileToImport
  File "ptxprint\utils.py", line 257, in getPDFconfig
  File "ptxprint\pdfrw\pdfreader.py", line 587, in __init__
    raise PdfParseError('Invalid PDF header: %s' %
ptxprint.pdfrw.errors.PdfParseError: Invalid PDF header: 'PK\x03\x04\x14\x00\x00\x00\x08\x00\x10L[WFÈyã¶X\x00\x00óó\x00\x00\x18\x00\x00\x00GSB16c1/60JASGSB16c1.SFM¥½[\x92#G\x92-ø?"³\x07ï¿\x88ldtÂ\x81x!?R\x92ï¬&\x8b\x14föå\xad¹'

PTXprint Version 2.3.51

It would be great if the load from ZIP worked, and if it would unpack everything into the same (relative) locations as the source was when the archive was made. In particular, I would like to have the .py file in the shared/ folder (so that it gets transferred via Send/Receive).

This would make enabling a 'notes only' output quite simple for a new project.

@markpenny markpenny added priority We want to fix this before next major release bug This is a step backwards Python This issue needs work on the Python code, no XeTeX involved. labels Oct 31, 2023
@markpenny
Copy link
Collaborator

Hi @klassenjm , yes - I'm just confirming that you're doing the right thing, but we obviously have a regression here with the import from a saved archive (which I have also just been able to reproduce locally).

AFAIK, if the .py file is stored in the same folder along with the other settings (in the shared/PTXprint/ folder, it will get S/R as well (unless Paratext is doing something smart to restrict 'dangerous' files from being shared in that way; I know it has a list of exclusions, but don't know if .py is on that list; .bat certainly is!)

The second part of this issue is making sure that the relative paths get updated, so that we're not pointing to the wrong location for the (imported) configuration, as is seen in this example:
image

@mhosken
Copy link
Collaborator

mhosken commented Oct 31, 2023

A case of incomplete feature. We imply we support zip import and then don't do it and treat all file types as pdf. Let's fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is a step backwards priority We want to fix this before next major release Python This issue needs work on the Python code, no XeTeX involved.
Projects
None yet
Development

No branches or pull requests

3 participants