lincolnloop / python-qrcode

Python QR Code image generator
https://pypi.python.org/pypi/qrcode
Other
4.36k stars 666 forks source link

Not scannable QR-Code on macOS console #175

Closed Endogen closed 5 years ago

Endogen commented 5 years ago

Hi,

i'm trying to create a QR-Code and show it on the console. It works but shows this image

This is my code:

        import qrcode

        qr = qrcode.QRCode()
        qr.add_data("104c7136574c86837069285b6760d53bd029a8a8063c3d4857e01660")
        qr.print_ascii()

I'm on macOS 10.14.5 with ZSH and Python 3.7. Not sure if this is related: https://github.com/lincolnloop/python-qrcode/issues/66

Endogen commented 5 years ago

After some testing, i can see it working on Windows. Any idea how i can get it working also on macOS with ZSH? Or can someone please test it on macOS without ZSH?

Endogen commented 5 years ago

Did some more tests and there is no issue if i create the QR-Code with this module: https://github.com/mnooner256/pyqrcode

The QR-Code is much larger but works fine image

My code:

        import pyqrcode

        address = "104c7136574c86837069285b6760d53bd029a8a8063c3d4857e01660"

        qr = pyqrcode.create(address, error="L", version=4)
        print(qr.terminal("black", "white", quiet_zone=2))

Maybe it's possible to take a look over there and grab some code

heuer commented 5 years ago

i'm trying to create a QR-Code and show it on the console. It works but shows this

IIRC you can get better results if you use iTerm2.

PyQRCode utilizes ANSI escape codes to generate the output. This project can do the same if you use the QRCode.print_tty() method

Endogen commented 5 years ago

Thanks for your answer! I see, iTerm2 is some advanced stuff :-) I'm actually pretty happy with ZSH but will look into it 👍

Nice! Didn't know about QRCode.print_tty(). Thanks for that.