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

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

Open
bserem opened this issue Oct 17, 2018 · 6 comments
Open

Comments

@bserem
Copy link

bserem commented Oct 17, 2018

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)
@jpwsutton
Copy link
Owner

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

@shrewmus
Copy link

shrewmus commented Jan 3, 2019

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.

@vertgo
Copy link

vertgo commented Jan 29, 2019

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

@vertgo
Copy link

vertgo commented Jan 29, 2019

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

@vitorio
Copy link

vitorio commented Nov 18, 2019

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.

@bserem
Copy link
Author

bserem commented Dec 29, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants