Some Tips for Using the steem-python Library on a Unix-like (Apple) or Linux Computer

in #steemit6 years ago

This post contains some basic information about using the official steem-python library. It is meant to be used in conjunction with other posts I am writing about steem-python scripting and isn’t really very comprehensive. However, it does have some simple information about running python scripts on Unix-like systems (the Apple terminal) or Linux systems.

The Steemit API has a library called "steem-python" that must be installed before the Steemit blockchain can be accessed using the Python language. See the steem-python website for instructions on how to install it (using pip or pip3). Python scripts using steem-python can do many useful things from the command line or the IDLE environment such as accessing the state of your account or searching the blockchain.

Python scripts can be run from the command line on a Unix-like system (such as the Apple terminal) or Linux system by putting the path to the python executable at the top of the text file that the script is in. On my computer, I put the following text on the first line:

#!/usr/bin/env /Library/Frameworks/Python.framework/Versions/3.6/bin/python3

Notice that you need to put "#!/usr/bin/env" before the path so the shell understands what you are doing. If you don't know the path, type in "which python3" or "which python" in the terminal and the complete path will be printed out. If you choose to put your script in a text file and run it from the command line in a terminal, remember to make your file executable using the "chmod" command.

Python scripts can also be run in IDLE (Integrated Development Environment) that comes with python installations. If a python script is run in IDLE, the “shebang” line is not necessary.

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63475.77
ETH 3117.23
USDT 1.00
SBD 3.94