#8 CMYK PDF generation fails with fedora-horizontal and fedora-vertical
Opened 3 years ago by salimma. Modified 10 months ago

Discovered this when writing automated tests. Fails with v2.2.1 in updates-testing as well as the current master.

❯ fedora-business-cards --cmyk-pdf fedora-vertical
Login to FAS:
Username: salimma
Password: 
Current business card layout:
Vertical cards don't hold much data ...:
   +-------------------------------------+
 n | Michel Alexandre Salim              |
 t | Fedora Project Contributor          |
   |                                     |
 0 | salimma@fedoraproject.org           |
 1 | fedoraproject.org                   |
 2 | michel-slm on irc.freenode.net      |
 3 |                                     |
 4 |                                     |
   +-------------------------------------+
Enter a line number to edit, or [y] to accept: y
Generating front...
Traceback (most recent call last):
  File "/usr/bin/fedora-business-cards", line 11, in <module>
    load_entry_point('fedora-business-cards==2.2', 'console_scripts', 'fedora-business-cards')()
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/frontend/cmdline.py", line 114, in main
    export.svg_to_cmyk_pdf(xml, 'front.pdf', options.height, options.width,
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 109, in svg_to_cmyk_pdf
    eps = eps_cmyk_convert(epsfilename, converter)
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 161, in eps_cmyk_convert
    rgb = tuple([int(x) for x in (red, green, blue)])
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 161, in <listcomp>
    rgb = tuple([int(x) for x in (red, green, blue)])
ValueError: invalid literal for int() with base 10: '0.298096'

https://pagure.io/fork/salimma/fedora-business-cards/tree/fix-cmyk has the fix but waiting for #7 to be merged before opening a PR, since it also modifies the test code to reenable cmyk_pdf output testing.

This is not occurring on my F31 box. I wonder if we are missing a dependency? I also can't reproduce it in an F32 container (assuming you were on F32). What is your OS version?

Metadata Update from @bex:
- Issue assigned to salimma

3 years ago

That's on my Fedora 32 box. Let me double check on another machine (and also verify that the stable version is also affected, not just my modified version - I'm pretty sure it was, on my machine anyway)

@bex Replicated on a new machine where I have not messed with this source code. Note, it only affects the fedora-horizontal and fedora-vertical generators - the default fedora one is fine. I'll update the summary.

~
❯ rpm -q fedora-business-cards
fedora-business-cards-2.2.1-1.fc32.noarch

~
❯ cat /etc/fedora-release
Fedora release 32 (Thirty Two)

❯ fedora-business-cards --cmyk-pdf fedora-vertical       
Login to FAS:
Username: salimma
Password: 

Current business card layout:
Vertical cards don't hold much data ...:
   +-------------------------------------+
 n | Michel Alexandre Salim              |
 t | Fedora Project Contributor          |
   |                                     |
 0 | salimma@fedoraproject.org           |
 1 | fedoraproject.org                   |
 2 | michel-slm on irc.freenode.net      |
 3 |                                     |
 4 |                                     |
   +-------------------------------------+
Enter a line number to edit, or [y] to accept: Generating front...
Traceback (most recent call last):
  File "/usr/bin/fedora-business-cards", line 11, in <module>
    load_entry_point('fedora-business-cards==2.2', 'console_scripts', 'fedora-business-cards')()
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/frontend/cmdline.py", line 114, in main
    export.svg_to_cmyk_pdf(xml, 'front.pdf', options.height, options.width,
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 109, in svg_to_cmyk_pdf
    eps = eps_cmyk_convert(epsfilename, converter)
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 161, in eps_cmyk_convert
    rgb = tuple([int(x) for x in (red, green, blue)])
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 161, in <listcomp>
    rgb = tuple([int(x) for x in (red, green, blue)])
ValueError: invalid literal for int() with base 10: '0.298096'

Out of curiosity, I checked if this is just because with my username there's too much info to fit for the vertical generator. Fails with bex as well:

~
❯ fedora-business-cards --cmyk-pdf fedora-vertical -u bex
Login to FAS:
Username: salimma
Password: 
Current business card layout:
Vertical cards don't hold much data ...:
   +-------------------------------------+
 n | Brian (bex) Exelbierd               |
 t | Fedora Project Contributor          |
   |                                     |
 0 | bex@fedoraproject.org               |
 1 | fedoraproject.org                   |
 2 | bexelbie on irc.freenode.net        |
 3 |                                     |
 4 |                                     |
   +-------------------------------------+
Enter a line number to edit, or [y] to accept: y
Generating front...
Traceback (most recent call last):
  File "/usr/bin/fedora-business-cards", line 11, in <module>
    load_entry_point('fedora-business-cards==2.2', 'console_scripts', 'fedora-business-cards')()
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/frontend/cmdline.py", line 114, in main
    export.svg_to_cmyk_pdf(xml, 'front.pdf', options.height, options.width,
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 109, in svg_to_cmyk_pdf
    eps = eps_cmyk_convert(epsfilename, converter)
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 161, in eps_cmyk_convert
    rgb = tuple([int(x) for x in (red, green, blue)])
  File "/usr/lib/python3.8/site-packages/fedora_business_cards/export.py", line 161, in <listcomp>
    rgb = tuple([int(x) for x in (red, green, blue)])
ValueError: invalid literal for int() with base 10: '0.298096'

OK, I got that replicated now too. I've done some reading and your fix looks good.

Login to comment on this ticket.

Metadata