| 1 |
Frequently Asked Questions |
| 2 |
========================== |
| 3 |
|
| 4 |
Frequently asked questions on the usage of schedule. |
| 5 |
Did you get here using an 'old' link and expected to see more questions? |
| 6 |
|
| 7 |
AttributeError: 'module' object has no attribute 'every' |
| 8 |
-------------------------------------------------------- |
| 9 |
|
| 10 |
I'm getting |
| 11 |
|
| 12 |
.. code-block:: text |
| 13 |
|
| 14 |
AttributeError: 'module' object has no attribute 'every' |
| 15 |
|
| 16 |
when I try to use schedule. |
| 17 |
|
| 18 |
This happens if your code imports the wrong ``schedule`` module. |
| 19 |
Make sure you don't have a ``schedule.py`` file in your project that overrides the ``schedule`` module provided by this library. |
| 20 |
|
| 21 |
|
| 22 |
ModuleNotFoundError: No module named 'schedule' |
| 23 |
----------------------------------------------- |
| 24 |
|
| 25 |
It seems python can't find the schedule package. Let's check some common causes. |
| 26 |
|
| 27 |
Did you install schedule? If not, follow :doc:`installation`. Validate installation: |
| 28 |
|
| 29 |
* Did you install using pip? Run ``pip3 list | grep schedule``. This should return ``schedule 0.6.0`` (or a higher version number) |
| 30 |
* Did you install using apt? Run ``dpkg -l | grep python3-schedule``. This should return something along the lines of ``python3-schedule 0.3.2-1.1 Job scheduling for humans (Python 3)`` (or a higher version number) |
| 31 |
|
| 32 |
Are you used python 3 to install Schedule, and are running the script using python 3? |
| 33 |
For example, if you installed schedule using a version of pip that uses Python 2, and your code runs in Python 3, the package won't be found. |
| 34 |
In this case the solution is to install Schedule using pip3: ``pip3 install schedule``. |
| 35 |
|
| 36 |
Are you using virtualenv? Check that you are running the script inside the same virtualenv where you installed schedule. |
| 37 |
|
| 38 |
Is this problem occurring when running the program from inside and IDE like PyCharm or VSCode? |
| 39 |
Try to run your program from a commandline outside of the IDE. |
| 40 |
If it works there, the problem is with your IDE configuration. |
| 41 |
It might be that your IDE uses a different Python interpreter installation. |
| 42 |
|
| 43 |
Still having problems? Use Google and StackOverflow before submitting an issue. |
| 44 |
|
| 45 |
ModuleNotFoundError: ModuleNotFoundError: No module named 'pytz' |
| 46 |
---------------------------------------------------------------- |
| 47 |
|
| 48 |
This error happens when you try to set a timezone in ``.at()`` without having the `pytz <https://pypi.org/project/pytz/>`_ package installed. |
| 49 |
Pytz is a required dependency when working with timezones. |
| 50 |
To resolve this issue, install the ``pytz`` module by running ``pip install pytz``. |
| 51 |
|
| 52 |
Does schedule support time zones? |
| 53 |
--------------------------------- |
| 54 |
Yes! See :doc:`Timezones <timezones>`. |
| 55 |
|
| 56 |
What if my task throws an exception? |
| 57 |
------------------------------------ |
| 58 |
See :doc:`Exception Handling <exception-handling>`. |
| 59 |
|
| 60 |
How can I run a job only once? |
| 61 |
------------------------------ |
| 62 |
See :doc:`Examples <examples>`. |
| 63 |
|
| 64 |
How can I cancel several jobs at once? |
| 65 |
-------------------------------------- |
| 66 |
See :doc:`Examples <examples>`. |
| 67 |
|
| 68 |
How to execute jobs in parallel? |
| 69 |
-------------------------------- |
| 70 |
See :doc:`Parallel Execution <parallel-execution>`. |
| 71 |
|
| 72 |
How to continuously run the scheduler without blocking the main thread? |
| 73 |
----------------------------------------------------------------------- |
| 74 |
:doc:`Background Execution<background-execution>`. |
| 75 |
|
| 76 |
Another question? |
| 77 |
----------------- |
| 78 |
If you are left with an unanswered question, `browse the issue tracker <http://github.com/dbader/schedule/issues>`_ to see if your question has been asked before. |
| 79 |
Feel free to create a new issue if that's not the case. Thank you 😃 |