QuickTutorial: Python 3.6 & steem-python

in #tutorial3 years ago (edited)

Postheader Logo

Welcome to this tutorial where I will show something you'll be able to quickly do yourself.

Today I got some headaches setting up a new tool for python development. I want to use steem-python on Python 3.6 and there are some difficulties to overcome.

what's wrong

What I've read Python 3.x changed some minor things like case sensitivity that just screws with some projects that didn't get an update yet.

For steem-python setuptools and pycrypto will create errors on installation.

I will explain step by step how to get it going on a windows system.

how to install

Download desired python version from the website and install it. Then open windows command prompt.

With Python a tool called pip should be installed which we will use now.

pip install -U setuptools
pip install -U pycrypto

This will create an error. Watch out for inttypes.h and navigate to the directory displayed in the error message. Open inttypes.h with a text editor like Notepad++.

edit inttypes.h and add

#define intmax_t long long
#define uintmax_t unsigned long long

It should now be something like:

#pragma once
#define _INTTYPES

#define intmax_t long long
#define uintmax_t unsigned long long

#include <corecrt.h>
#include <stdint.h>

_CRT_BEGIN_C_HEADER

...

Go back to the command prompt and again enter:

pip install -U pycrypto

If everything runs fine revert changes made to inttypes.h and run:

pip install -U steem

more errors

If you get the Error:

ImportError: No module named 'winrandom'

Go to the directory where nt.py is located. Again, see the location in the error message.

Replace

import winrandom

with

from . import winrandom

The pycrypto project hasn't been under development for a while so you should be fine editing these files.


If you get:

OSError: [WinError 126]

the scrypt module is not working inside bip83.py which is part of steembase. However it will fall back to pylibscrypt.

pip uninstall scrypt


Congratulations, steem-python is now ready to use.

Hope that helped.