Last active
December 27, 2021 23:45
-
-
Save BomberFish/3a71d79037791dcbd6f60b514f04577b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#importing pip like this will fail in the future, should be replaced. | |
for n in range(1): | |
try: | |
import pip | |
except ImportError as missing: | |
print("You don't have pip. Exiting...") | |
exit() | |
#install package function | |
def install(package): | |
pip.main(['install', package]) | |
#qrcode module checker & install | |
for n in range(1): | |
try: | |
import qrcode | |
except ImportError as missing: | |
if input("You don't have the qrcode module. Install it now? [Y/n]").lower() == "y": | |
install(missing.name) | |
print("Please run the program again for changes to apply.") | |
exit() | |
else: | |
print("Abort.") | |
exit() | |
#data prompt | |
data = input("What do you want to be converted into a QR code? ") | |
#convert to qr code | |
output = qrcode.make(data) | |
#ask filename to save as | |
saveas = input("What do you want the file to be called? ") | |
#save file | |
output.save(saveas + ".png") | |
#print filename | |
print("Saved as " + saveas + ".png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment