You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the GitHub search to find a similar question and didn't find it.
I searched the Typer documentation, with the integrated search.
I already searched in Google "How to X in Typer" and didn't find any information.
I already read and followed all the tutorials in the docs and didn't find an answer.
I already checked if it is not related to Typer but to Click.
Commit to Help
I commit to help with one of those options 👆
Example Code
importqrcodefromappimportappfromtyperimportOptionfromtyping_extensionsimportAnnotated@app.command()defwifiqr(
password: Annotated[
str, Option(prompt=True, confirmation_prompt=True, hide_input=True, help="The password of the network.")
],
ssid: str=Option(..., help="The SSID of the network."),
encryption: str=Option("WPA", help="The encryption type of the network."),
hidden: bool=Option(False, help="Whether the network is hidden."),
ascii: bool=Option(False, help="Print the QR code as ASCII in terminal, otherwise an image will be saved."),
) ->None:
""" Generate a QR code for a WiFi network. The QR code will contain the SSID, password, encryption, and hidden status. Args: - ssid (str): The SSID of the network. - password (str): The password of the network. - encryption (str): The encryption type of the network. - hidden (bool): Whether the network is hidden. """wifi_data=f"WIFI:S:{ssid};T:{encryption};P:{password};H:{int(hidden)};;"qr=qrcode.QRCode()
qr.add_data(wifi_data)
qr.make()
ifascii:
qr.print_ascii(invert=True)
else:
qr.make_image(fill_color="black", back_color="white").save("wifi.png")
Butitpopsupthenexterror:
![image](https://github.com/user-attachments/assets/6e959402-00ff-493e-b162-694ed0c3d855)
Description
I have a code snippet like the code above
But it pops up the next error:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
I have a code snippet like the code above
But it pops up the next error:
Operating System
Linux, Windows
Operating System Details
No response
Typer Version
0.15.1
Python Version
3.11.5
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions