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

can only concatenate str (not "bytes") to str while using the print function #69

Open
aleperuz opened this issue Aug 8, 2022 · 7 comments

Comments

@aleperuz
Copy link

aleperuz commented Aug 8, 2022

When i try to print a photo with pret the program crush with error.
can only concatenate str (not "bytes") to str
i modified the program to make sure that the given variable is a string.
self.send(c.UEL + str(data) + c.UEL)
If I print simple text it prints without errors. So I understood that with pret you can only print text, even if I don't understand why since there is the variable that converts pdf and images into files that the printer understands.
Hope this problem is solved.

@deFr0ggy
Copy link

deFr0ggy commented Jan 9, 2023

Hey @aleperuz,

I tried the same, although i am getting the following.

image

Fixed the line as below.

image

How had you fixed this?

@aleperuz
Copy link
Author

aleperuz commented Jan 9, 2023

@deFr0ggy yes use python 2 and add the fixes from another issue

@aleperuz
Copy link
Author

aleperuz commented Jan 9, 2023

@deFr0ggy

Try this one:

edit the script that will send commands in the language of your printer (pjl.py, pcl.py or postscript.py)
Add this:
import sys
reload(sys)
sys.setdefaultencoding('iso-8859-1')

@deFr0ggy
Copy link

deFr0ggy commented Jan 9, 2023

Thanks @aleperuz , just got it to resolve this, it's printing the data from "*.ps" file provided now!

@deFr0ggy
Copy link

deFr0ggy commented Jan 9, 2023

it the script that will send commands in the language of your printer (pjl.py, pcl.py or postscript.py)
Add this:
import sys
reload(sys)
sys.setdefaultencoding('iso-8859-1')

Makes sense! Thanks!

@muhammedakinci0
Copy link

@aleperuz can you help me on discord? discord:defacermaster

@muhammedakinci0
Copy link

@deFr0ggy help me on discord please discord:defacermaster

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

No branches or pull requests

3 participants