instax_api icon indicating copy to clipboard operation
instax_api copied to clipboard

UnicodeDecodeError: 'ascii' codec can't decode byte 0xfb in position 0

Open bserem opened this issue 6 years ago • 6 comments

After a couple of successful prints on the SP2 I tried to print a 3rd image and got the following error. All attepts failed.

Disconnecting my debian system from the printer network and reconnecting solved the issue. I did not reboot the printer, only re-connected to it.

It might be nothing, but since it occured I am passing this information here.

bserem@dwarf ~/Desktop/Instax/SP2 $ instax-print SRM02856.JPG 
--- Instax Printer Python Client ---

Connecting to Printer.
Traceback (most recent call last):
  File "/usr/local/bin/instax-print", line 103, in <module>
    info = myInstax.getPrinterInformation()
  File "/usr/local/lib/python3.6/dist-packages/instax/sp2.py", line 191, in getPrinterInformation
    printerModel = self.getPrinterModelName()
  File "/usr/local/lib/python3.6/dist-packages/instax/sp2.py", line 94, in getPrinterModelName
    response = self.sendCommand(cmdPacket)
  File "/usr/local/lib/python3.6/dist-packages/instax/sp2.py", line 81, in sendCommand
    decodedResponse = self.packetFactory.decode(reply.data)
  File "/usr/local/lib/python3.6/dist-packages/instax/packet.py", line 63, in decode
    return(ModelNameCommand(mode=self.mode, byteArray=byteArray))
  File "/usr/local/lib/python3.6/dist-packages/instax/packet.py", line 670, in __init__
    self.payload = self.decodeRespPayload(byteArray)
  File "/usr/local/lib/python3.6/dist-packages/instax/packet.py", line 697, in decodeRespPayload
    self.modelName = self.getPrinterModelString(16, byteArray)
  File "/usr/local/lib/python3.6/dist-packages/instax/packet.py", line 435, in getPrinterModelString
    return str(byteArray[offset: offset + 4], 'ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xfb in position 0: ordinal not in range(128)

bserem avatar Oct 17 '18 15:10 bserem

Hi @bserem, thanks for raising this issue. Have you been able to recreate this, or was it just a one off?

jpwsutton avatar Jan 02 '19 21:01 jpwsutton

I also have I think the same issue. It occurs when a printer is not ready after the previous print-task and I try for example send a command to obtain printer info (prints remaining). I guess that printer has some answer bytes that don't know by response-parser.

shrewmus avatar Jan 03 '19 08:01 shrewmus

I'm having the same issue, I will try to catch and catch it

vertgo avatar Jan 29 '19 05:01 vertgo

I fixed it by logging into the printer using the native app and removing the password

vertgo avatar Jan 29 '19 05:01 vertgo

I'm seeing this while debugging the SP-1 printing functionality, too.

If I try to print two images immediately back-to-back, this happens. If I wait around 30 seconds or so, it doesn't.

vitorio avatar Nov 18 '19 00:11 vitorio

It appeared again today after a long time. I guess it is not something that makes sense to hunt down and debug, since it doesn't result to failed print (so no lost film) and it works most of the time.

Just like @vitorio said above, it only happens if there is no cooldown between two prints.

Maybe we could add a message at the end of a print to instruct users to wait for a half a minute before continuing to another print.

bserem avatar Dec 29 '19 14:12 bserem