Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix: #5 fixing writer.py after 1.9.75.123 pull #402

Merged
merged 2 commits into from
May 31, 2020

Conversation

vladisld
Copy link
Collaborator

@vladisld vladisld commented May 29, 2020

There is a regression in test_writer.py test after 1.9.75.123 release/

ERROR: test_writer.test_run

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/travis/build/backtrader2/backtrader/tests/test_writer.py", line 48, in test_run
    writer=(bt.WriterStringIO, dict(csv=True)))
  File "/home/travis/build/backtrader2/backtrader/tests/testcommon.py", line 110, in runtest
    cerebro.run()
  File "/home/travis/build/backtrader2/backtrader/backtrader/cerebro.py", line 1085, in run
    wr = wrcls(*wrargs, **wrkwargs)
  File "/home/travis/build/backtrader2/backtrader/backtrader/metabase.py", line 88, in __call__
    _obj, args, kwargs = cls.doinit(_obj, *args, **kwargs)
  File "/home/travis/build/backtrader2/backtrader/backtrader/metabase.py", line 78, in doinit
    _obj.__init__(*args, **kwargs)
  File "/home/travis/build/backtrader2/backtrader/backtrader/writer.py", line 218, in __init__
    self.out = self.out()
AttributeError: 'WriterStringIO' object has no attribute 'out'

The problem is with removed initialization of out member in init method of WriterFile. The member is a actually expected to be initialized in init method - see the implementation of the WriterStringIO.

The possible simple fix, is to move the self.out = ... initialization in WriterStringIO.init to WriterStringIO.start method

@mementum mementum merged commit 4410edb into mementum:master May 31, 2020
vladisld added a commit to backtrader2/backtrader that referenced this pull request May 31, 2020
bug fix: #5 fixing writer.py after 1.9.75.123 pull (mementum#402)
@vladisld vladisld deleted the bug_fix_5 branch June 2, 2020 18:44
Grenite pushed a commit to Grenite/backtrader that referenced this pull request Dec 2, 2021
* bug fix: #5 fixing writer.py after 1.9.75.123 pull

* Renaming _start() to _start_output()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants