Replies: 1 comment
-
Without seeing more of a complete example with directory structure it looks like some type of module visibility issue. I have scheduled tasks using asyncio by obtaining the asyncio.get_event_loop() inside of addons. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Tried to add apscheduler to mitmproxy script...,
Script itself is launched like:
~$ mitmdump -s script_file.py -p 5678 -m upstream:http://127.0.0.1:9999 -k --listen-host=WAN_IP --set block_global=false
however, every scheduled job generates an error:
`[13:19:56.262] Unable to restore job "myschedtestjob_every_10s" -- removing it
Traceback (most recent call last):
File "/home/s/SOLVER_charm/venv/lib/python3.11/site-packages/apscheduler/util.py", line 271, in ref_to_obj
obj = import(modulename, fromlist=[rest])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'mitmproxy_script'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/s/SOLVER_charm/venv/lib/python3.11/site-packages/apscheduler/jobstores/sqlalchemy.py", line 148, in _get_jobs
jobs.append(self._reconstitute_job(row.job_state))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/s/SOLVER_charm/venv/lib/python3.11/site-packages/apscheduler/jobstores/sqlalchemy.py", line 134, in _reconstitute_job
job.setstate(job_state)
File "/home/s/SOLVER_charm/venv/lib/python3.11/site-packages/apscheduler/job.py", line 273, in setstate
self.func = ref_to_obj(self.func_ref)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/s/SOLVER_charm/venv/lib/python3.11/site-packages/apscheduler/util.py", line 273, in ref_to_obj
raise LookupError('Error resolving reference %s: could not import module' % ref)
LookupError: Error resolving reference mitmproxy_script.bogactwo_4_74:myschedtestjob: could not import module`
anyone got through that?
Beta Was this translation helpful? Give feedback.
All reactions