Hi @revant_one,
Thanks for your response. Sorry, I couldn’t reply to this earlier.
I tried this following code, but it is breaking off during bench migrate. Is there anything wrong with this?
def make_text(args):
save_path = 'site1.local/private/files'
file_name = os.path.join(save_path, "qrcode.txt")
f= open(file_name,"w+")
f.write("^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA")
f.write("^PR2,2~SD15^JUS^LRN^CI0^XZ")
f.write("^XA^MMT^PW812^LL0406^LS0")
for rows in summ_data:
## number_labels = int(number_labels)
nol = int(number_labels) + 1
for x in xrange(1, nol):
f.write("^FT250,79^A0R,28,28^FH\^FD%s^FS" % (rows[0]))
f.write("^FT533,53^A0R,28,28^FH\^FD%s^FS" % (rows[1]))
f.write("^FT300,301^BQN,2,8^FH\^FDMA1%s^FS" % (rows[0]))
f.write("^PQ1,0,1,Y^XZ")
frappe.msgprint(_("Text File created"))
f.close()
frappe.msgprint(_(“Executing the below:”))
frappe.local.response.filename = "qrcode.txt"
with open(“site1.local/private/files/qrcode.txt”, “r+b”) as fileobj:
filedata = fileobj.read()
frappe.logger().debug("Inside")
frappe.local.response.filecontent = filedata
frappe.local.response.type = "download"
Error on traceback is:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/uma/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 94, in <module>
main()
File "/home/uma/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name='bench')
File "/home/uma/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/uma/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/uma/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/uma/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/uma/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/uma/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/uma/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/uma/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File "/home/uma/frappe-bench/apps/frappe/frappe/commands/site.py", line 226, in migrate
compileall.compile_dir('../apps', quiet=1)
File "/usr/lib/python2.7/compileall.py", line 57, in compile_dir
quiet):
File "/usr/lib/python2.7/compileall.py", line 57, in compile_dir
quiet):
File "/usr/lib/python2.7/compileall.py", line 57, in compile_dir
quiet):
File "/usr/lib/python2.7/compileall.py", line 57, in compile_dir
quiet):
File "/usr/lib/python2.7/compileall.py", line 57, in compile_dir
quiet):
File "/usr/lib/python2.7/compileall.py", line 50, in compile_dir
if not compile_file(fullname, ddir, force, rx, quiet):
File "/usr/lib/python2.7/compileall.py", line 99, in compile_file
ok = py_compile.compile(fullname, None, dfile, True)
File "/usr/lib/python2.7/py_compile.py", line 115, in compile
py_exc = PyCompileError(err.__class__, err, dfile or file)
File "/usr/lib/python2.7/py_compile.py", line 49, in __init__
errmsg = tbtext.replace('File "<string>"', 'File "%s"' % file)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 151: ordinal not in range(128)