i was able to connect to an external db but while trying to generate a qr code from the result i'm getting this error.
import pymssql, pandas as pd, openpyxl, pyqrcode, os
QRCode(content=b'0001-87L58/1', error='H', version=2, mode='alphanumeric')
Traceback (most recent call last):
File "C:/Users/MSE/PycharmProjects/qrcode_gen/CIN_from_Server.py", line 25, in <module>
qr.eps(PIN +'.eps', scale=2.5, module_color='#36C')
File "C:\Users\MSE\PycharmProjects\Python4everyone\venv\lib\site-packages\pyqrcode\__init__.py", line 624, in eps
background, quiet_zone)
File "C:\Users\MSE\PycharmProjects\Python4everyone\venv\lib\site-packages\pyqrcode\builder.py", line 1461, in _eps
f, autoclose = _get_writable(file_or_path, 'w')
File "C:\Users\MSE\PycharmProjects\Python4everyone\venv\lib\site-packages\pyqrcode\builder.py", line 924, in _get_writable
stream_or_path = open(stream_or_path, mode)
FileNotFoundError: [Errno 2] No such file or directory: '0001-87L58/1.eps'
My code:
import pymssql, pandas as pd, openpyxl, pyqrcode, os
#Connecting to Db using Pymssql library
host = "myHost"
username = "Mine"
password = "mine#$"
database = "external"
conn = pymssql.connect(host, username, password, database) #connecting string
read_query = " Select * FROM dbo.M_tblPIN WHERE TI = 'A01' "
mycursor = conn.cursor()
mycursor.execute(read_query)
result = mycursor.fetchall()
for item in result:
PIN = item[12]
# using pyqrcode to create the barcode
qr = pyqrcode.create(PIN)
print(qr)
qr.eps(PIN + '.eps', scale=5, module_color='#36C')
qr.eps(PIN + '.eps', background='#eee')
How to generate the qrcode and save it in an external directory?