AttributeError: 'Steemd' object has no attribute 'commit' in steem-python

in utopian-io •  7 years ago  (edited)

When using the functions buy(), sell() and cancel() from dex.py / the Dex class it returns the following error

AttributeError: 'Steemd' object has no attribute 'commit'

Expected behavior

When executing the following example program dex_bug.py you expect it to place an order on the market

from steem.dex import Dex

if __name__ == '__main__':
    dex = Dex()
    dex.sell(
        amount=0.1,
        quote_symbol="SBD",
        rate=2.0,
        expiration=60,
        killfill=False,
        account="amosbastian"
    )

which would look like this

order_example.png

Actual behavior

When executing dex_bug.py you get the following output

$ python dex_bug.py 
Traceback (most recent call last):
  File "dex_bug.py", line 11, in <module>
    account="amosbastian"
  File "/home/amos/Documents/steem-python/steem/dex.py", line 232, in sell
    return self.steemd.commit.finalizeOp(op, account, "active")
AttributeError: 'Steemd' object has no attribute 'commit'

How to reproduce

An easy way to reproduce this error is to have Python3.6 installed and do the following

$ virtualenv env
$ source env/bin/activate
$ (env) pip install steem

then create a file called dex_bug.py (the example shown above) and execute it with

$ (env) python dex_bug.py
  • Operating system: Ubuntu 16.04

How to solve it?

I have submitted a pull request on the official steem-python GitHub, which can be found here. You can either use my branch to install steem-python with a working dex.py, or manually edit your local one by copying from here.

Changes made

The changes I made to dex.py to fix it can be seen below

changed_made_dex.png



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
  ·  7 years ago (edited)

Thank you for the contribution. It has been approved.

I able to reproduce the bug and the fix.

You can contact us on Discord.
[utopian-moderator]

Hey @helo, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Thanks!