Closed NicolasCaous closed 4 years ago
your error is elsewhere, i think, in croniter related imports that may fail, and then croniter is not loaded.
Having a quick peek at the __init__.py
shows the problem actually:
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from .croniter import (
croniter,
CroniterBadDateError, # noqa
CroniterBadCronError, # noqa
CroniterNotAlphaError # noqa
) # noqa
croniter.__name__ # make flake8 happy
The base exception CroniterError
isn't being exported.
Just to clarify, I want to create a try-catch block that looks like this:
try:
...
except CroniterError as ex:
...
But since the base class isn't exported, I have to do something ugly like this:
try:
...
except (CroniterBadCronError, CroniterBadDateError, CroniterNotAlphaError) as ex:
...
Or like this:
try:
...
except CroniterBadCronError.__bases__[0] as ex:
...
If you could export the base error, that would make exception handling a lot cleaner! 😄
I can't import the croniter base exception on the latest version of croniter (croniter==0.3.31):
python info:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32