While using pyzk library:
my Code:
`
from zk import ZK, const
@frappe.whitelist()
def call_Attendence():
conn = None
zk = ZK('192.168.1.10', port=4370, timeout=5)
try:
conn = zk.connect()
conn.disable_device()
users = conn.get_users()
for user in users:
privilege = 'User'
if user.privilege == const.USER_ADMIN:
privilege = 'Admin'
print(' Name : {}'.format(user.name))
conn.test_voice()
conn.enable_device()
except Exception:
print("Process terminate :")
finally:
if conn:
conn.disconnect()
And i get this Error:
i Use this command to run my function: frappe-bench$ bench execute âpathto functionâ: Response i get is here:
Traceback (most recent call last): File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/sibghat/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 94, in <module> main() File "/home/sibghat/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main click.Group(commands=commands)(prog_name='bench') File "/home/sibghat/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/home/sibghat/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/home/sibghat/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/sibghat/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/sibghat/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/sibghat/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/home/sibghat/frappe-bench/env/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/home/sibghat/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func ret = f(frappe._dict(ctx.obj), *args, **kwargs) File "/home/sibghat/frappe-bench/apps/frappe/frappe/commands/utils.py", line 120, in execute ret = frappe.get_attr(method)(*args, **kwargs) File "/home/sibghat/frappe-bench/apps/frappe/frappe/__init__.py", line 919, in get_attr return getattr(get_module(modulename), methodname) File "/home/sibghat/frappe-bench/apps/frappe/frappe/__init__.py", line 704, in get_module return importlib.import_module(modulename) File "/home/sibghat/frappe-bench/env/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 673, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 665, in exec_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "/home/sibghat/frappe-bench/apps/attendence2/attendence2/doctype/attendence/attendence.py", line 8, in <module> from zk import ZK, const File "/home/sibghat/frappe-bench/env/lib/python3.5/site-packages/zk/__init__.py", line 2, in <module> from base import ZK ImportError: No module named 'base'