jpwsutton / instax_api

An Api for the Fujifilm Instax SP-2 printer written in Python
MIT License
136 stars 19 forks source link

Doesn't work when compiling from latest master #9

Closed bserem closed 6 years ago

bserem commented 6 years ago

When compiling latest master (d06a1a4) I get this when I try to run the tool:

$ instax-print 
Traceback (most recent call last):
  File "/usr/local/bin/instax-print", line 4, in <module>
    __import__('pkg_resources').run_script('instax-api==0.5', 'instax-print')
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 657, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 1428, in run_script
    .format(**locals()),
pkg_resources.ResolutionError: Script 'scripts/instax-print' not found in metadata at '/home/bserem/.local/lib/python3.6/site-packages/instax_api-0.5.dist-info'

Checking out 14d9aea compiles and goes a bit deeper, but still doesn't print:

$ instax-print ~/Desktop/6.JPG -v 3
--- Instax Printer Python Client ---

Connecting to Printer.
Model: SP-3
Firmware: 01.02
Battery State: 3
Prints Remaining: 10
Total Lifetime Prints: 10

Printing Image: /home/bserem/Desktop/6.JPG
Traceback (most recent call last):
  File "/usr/local/bin/instax-print", line 4, in <module>
    __import__('pkg_resources').run_script('instax-api==0.4', 'instax-print')
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 657, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 1437, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.6/dist-packages/instax_api-0.4-py3.6.egg/EGG-INFO/scripts/instax-print", line 116, in <module>
    instaxImage.convertImage()
  File "/usr/local/lib/python3.6/dist-packages/instax_api-0.4-py3.6.egg/instax/instaxImage.py", line 103, in convertImage
    self.myImage = pure_pil_alpha_to_color_v2(newImage, (255,255,255))
  File "/usr/local/lib/python3.6/dist-packages/instax_api-0.4-py3.6.egg/instax/instaxImage.py", line 268, in pure_pil_alpha_to_color_v2
    background.paste(image, mask=image.split()[3])  # 3 is the alpha channel
IndexError: tuple index out of range
jpwsutton commented 6 years ago

Hi @bserem, that's odd, I'm not too sure why those errors are being thrown. I've just pushed v0.6 to pypi to fix Issue #8, so it might be worth trying again with that one.

Just to be safe, I'd uninstall the current version, and re-install from scratch with pip3: sudo pip3 install instax-api

bserem commented 6 years ago

Fix for #8 and a fresh install from Pip allows things to move on.

I haven't printer anything, but passing a JPG file with -v 3 attempts to connect to the printer just fine.