You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the latest release 0.6.2 on Python 3.9.15 but getting the following stacktrace while running the Backtest, any ideas what's wrong?
Traceback (most recent call last):
...
from backtesting import Strategy
File "/opt/dev/myvenv/lib/python3.9/site-packages/backtesting/__init__.py", line 68, in <module>
from . import lib # noqa: F401
File "/opt/dev/myvenv/lib/python3.9/site-packages/backtesting/lib.py", line 28, in <module>
from .backtesting import Backtest, Strategy
File "/opt/dev/myvenv/lib/python3.9/site-packages/backtesting/backtesting.py", line 1775, in <module>
__all__ = [getattr(v, '__name__', k)
File "/opt/dev/myvenv/lib/python3.9/site-packages/backtesting/backtesting.py", line 1777, in <listcomp>
if ((callable(v) and v.__module__ == __name__ or # callables from this module
AttributeError: 'functools.partial' object has no attribute '__module__'
The text was updated successfully, but these errors were encountered:
Ok I fixed it by changing the backtesting's backtesting.py and lib.py bottom code to the following (note the new hasattr before just assuming there is a __module__ attribute):
# NOTE: Don't put anything below this __all__ list
__all__ = [getattr(v, '__name__', k)
for k, v in globals().items() # export
if ((callable(v) and (hasattr(v, '__module__') and v.__module__ == __name__) or # callables from this module
k.isupper()) and # or CONSTANTS
not getattr(v, '__name__', k).startswith('_'))] # neither marked internal
# NOTE: Don't put anything below here. See above.
I'm using the latest release 0.6.2 on Python 3.9.15 but getting the following stacktrace while running the Backtest, any ideas what's wrong?
The text was updated successfully, but these errors were encountered: