Hi, manually when erpnext_sync.py is run in cmd line it works.
When installed as a windows service and try to start the service. The below msg displays,
Below is the error details which i got in event log,
Python could not import the service’s module
Traceback (most recent call last):
File “C:\TimeAttendance\biometric-attendance-sync-tool-master\erpnext_sync_win.py”, line 4, in
from erpnext_sync import main
File “C:\TimeAttendance\biometric-attendance-sync-tool-master\erpnext_sync.py”, line 305, in
status = pickledb.load(’/’.join([config.LOGS_DIRECTORY, ‘status.json’]), True)
File “C:\Program Files\Python36\lib\site-packages\pickledb.py”, line 43, in load
return PickleDB(location, auto_dump, sig)
File “C:\Program Files\Python36\lib\site-packages\pickledb.py”, line 57, in init
File “C:\Program Files\Python36\lib\site-packages\pickledb.py”, line 77, in set_sigterm_handler
File “C:\Program Files\Python36\lib\signal.py”, line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
I have the same problem! Did you resolve it? Thank you
Did you resolve it? Can’t find any solution!
Faced the same error with the windows service. So found an alternative to use Windows Task Scheduler to schedule frequent run for the script. Also for this to work make sure that the local_config.py file has been correctly configured. You can invoke the erpnext_sync.py program manually once to do the initial sync and double check if everything is working fine.
You can add a new task in Windows Task Scheduler with the following settings. This will run the script every 5 mins and sync the updated data with your erpnext system.
Add Trigger to run every day at interval of 5 minutes
a) Provide path to where python is installed. I have version 3.10, your directory will change based on which version you have installed.
b) Option Parameter - provide the name of the script erpnext_sync.py (not the erpnext_sync_win.py). This script will be executed.
c) Start Directory - Where you have stored the erpnext_sync.py file. Make sure no one moves or deletes the directory. Also ensure that the path as a trailing ** in the end.
In the conditions change so that only 1 instance is running at a given time. The initial sync can take longer.