steemit / steem-python

The official Python (3) library for the Steem Blockchain.
https://steem.io
MIT License
153 stars 98 forks source link

Commit calling into TransactionBuilder Python 2.7 str/unicode incompatibility #190

Closed ghost closed 6 years ago

ghost commented 6 years ago

I can post content smoothly with python3.6, but when I change to post it with python2.7.14, I get a Error that is "Invalid TransactionBuilder Format". I will simplify the problem into the following code:

from stee import Steem
s = Steem(...)
s.post(title='test', body='test', author='myname', tags=('steemtest',), permlink='ywqamoc1')

here is Error content:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/site-packages/steem/commit.py", line 353, in post
    return self.finalizeOp(ops, author, "posting")
  File "/usr/local/lib/python2.7/site-packages/steem/commit.py", line 132, in finalizeOp
    tx.sign()
  File "/usr/local/lib/python2.7/site-packages/steem/transactionbuilder.py", line 118, in sign
    raise ValueError("Invalid TransactionBuilder Format")
ValueError: Invalid TransactionBuilder Format

How to solve this problem ?

cyon1c commented 6 years ago

The error raised masks the actual issue, which is unicode vs str handling in 2.7.

The actual error is descriptor 'title' requires a 'str' object but received a 'unicode'.

This appears to be a Python 2 bug only.

cyon1c commented 6 years ago

This should be resolved with #203 .