My first Script in Python using Steem Module on Windows 7 64bit - Journey

in #steem7 years ago

Finally, after 4 days of headaches I managed to install Python on Windows 7 64 bit.

Last few days, I beat my head around installing the Steem module on Python.
First I installed Anaconda and couldn't for the life of me succeed installing the steem module.
Here is a copy of the command prompt : https://drive.google.com/file/d/0BwG9EFzvuAxUdktLSEJBTndCREk/view?usp=sharing

steemit error.PNG

A smarter and more experienced person (I won't name him, because I don't know if the want's to be named) told me that the encryption module requires scrypt, which is a C library that is failing to compile on Windows.

Sadly, he couldn't help me more than that, given the fact that he had no experience on Windows, but I was really grateful for him going out of his way and helping me.


On day 2, I used a bit of my free time to scour the Internet in the hopes I could find a solution to this problem, but nothing that I have found, worked. I installed and uninstalled C++ dev tools, libraries, C++ community, nothing.
Even got other error while trying all of this, but I regret I didn't made some print-screens.


At this point, I was losing hope fast, I decided to get a Digital Ocean Droplet with Debian and try python there. ( tightvnc-2.8.8-gpl-setup-64bit proved useless , actually I installed, in the end, UltraVNC_1_2_16_X64_Setup)

1.PNG

Here comes another problem, connecting remotely to the droplet and it's Debian graphical interface.

su_tudor.PNG

After a lot of sweat and tutorials that weren't up to date I finally got the connection going.... only to see a blank screen.
enough_droplet_blank.PNG


On day 3, I decided to uninstall every bit of Python on my system and Visual Studio, Anaconda, everything and start over.

I followed this tutorial made @trentie
https://steemit.com/python/@trentie/installing-the-steem-python-library-under-windows , thank you so much @trentie!

So, I installed Python 3.5.2 64bit,
Googled, VS2015 community edition with updates , and installed that.
Installed OpenSSL 1.1.0f (64bit) from https://www.openssl.org
pip install ujson‑1.35‑cp35‑cp35m‑win_amd64.whl
pip install steem

And surprise surprise, it installed everything and no error!

I started python.exe and wrote:

from steem import Steem
s = Steem()

ERROR!
IMG_20170926_144727943.jpg

I stopped and went to bed....

Day 4:
A family member of mine had to go to the hospital again today, after being discharged last Friday.
After spending all day and evening in the hospital, came home, eaten and though to myself... I have to do something to get my mind off things..

I fired up the laptop and searched for a solution, the solution I found is here :
https://github.com/steemit/steem-python/issues/50
So, I went ahead and edited the account.py located on my computer at C:\Program Files\Python35\Lib\site-packages\steem and replaced funcy.simple_funcs with funcy.funcs

Wrote this piece of code:
first script_python_steem.PNG


And vola, it is aliveee!

alive_.PNG


And this is my journey on making my first script on python using steem module.
This is the first step to my goal, to automate the #guessthecell game (bot will check players cells and reply if a cell is already taken, keep track of cells and calculate rewards)

Thank you for reading and I wish you a good nigh/day ahead.

Sort:  

I forgot, I got this error, too
https://stackoverflow.com/questions/6534505/how-to-fix-libeay32-dll-was-not-found-error

I just copied the contents of openssl-1.0.2k-x64_86-win64.zip into C:\Windows\System32 and was good to go!

oh wow, reading your post reminded me of the issues I had with steem-python. I had done similar methods to overcome the initial errors of scrypt and visual studio. I tried Anaconda, and then finally gave up on windows. I decided to get a virtual machine and install lubuntu(lightweight ubuntu) on it. Then i encountered the funcy error, so i uninstalled the funcy package and installed version 1.8 of funcy. Finally got everything up and running after almost 3 days of my first attempt on windows. I would suggest using https://github.com/Netherdrake/steem-python instead of the official steem-python repo because updates are made more frequently(including the funcy error) .

Thank you for taking the time to reply, @sqamemal

I will also try the Drake repo and will contact you on chat to talk. 👍
But now I have to run, when I will have some free time I will contact you.

Have a good one 🤗

What do you think I should replace?

root@frcloud:~/steem-python/steem# nano account.py
GNU nano 2.5.3                                                        File: account.py                                                                                                             

import datetime
import math
import time
from contextlib import suppress

from funcy.colls import walk_values, get_in
from funcy.seqs import take
from funcy import rpartial
from steembase.exceptions import AccountDoesNotExistsException
from toolz import dissoc

from .amount import Amount
from .blockchain import Blockchain
from .converter import Converter
from .instance import shared_steemd_instance
from .utils import parse_time, json_expand

I don't know what the error is and ,cause you are on linux based OS, don't know if I will...

Sorry to interrupt your post and the conversation about it.

But I need help and don't know where to get it... read through a whole bunch of steemit posts, manuals, readmes and stuff and guess I just don't find the right trees in all that woods.

I am quiet new at steemit and my knowledge about coding is somewhere 0,001 on a scale seems to last to eternity...

I want to run this and that to make my steemit routines much more easier... but I really don't have any clou how to do it...

The good news... I already "mastered" to install python 3.5 on my Windows 7 and did the first "script" of usually almost every python newbie printing "Hello World" on my screen...

Which steps lie ahead of me now to use the two routines mentioned above ?

I would be very happy for a as much as possible detailed plan to master the trail...

Thank you so far !


affe.jpg
@honolulu

Also, if you need any help with the bot for #gtc, I would be happy to help you out. Hit me up on steemit.chat or discord with the same username.

Well done! Many problems solved on your way to the first script ;-)
J

Thank you J,
Yeah, that is one way to learn, out of one's ones me mistakes ...

Thanks for sharing your code.

How long does it takes to execute the code?
If I only want STEEM balance it gets beck in sell than a second.
If I also want SBD balance it takes around 100 seconds for code to complete. Is this normal or Steem block chain has some problems?

Hi @veleje,
The code takes a bit longer than expected to run.
I haven't inserted a timer to see how long it takes, I will put that on my list of things to do.
Last time I ran the code it was taking about 3 or 4 seconds.
I am sure that somebody with more experience in blockchain architecture could answer this.
I am curious, too.

Have a good one !

Thanks for the answer. It is OK now, it must have been some block-chain slow down at that time. I get now information back fast, usually less than one second. Looking forward to see more steemit related python code from you :-)))

Glad to hear that,
I am looking forward to writing some code, too.
Just have to find the time between everything that is going on right now.
I am interested on what you are coding, will follow you 😊

Congrats on getting it to work! I've never tried anything like this, but I'm sure it was frustrating trying many things over and over again to get it to work. Glad you are seeing results now!

I think your idea of an automated bot for #guessthecell is great, especially since I participate in the game each week. I wish you the best!

@originalworks

Thank you,
Yes it was frustrating as hell, but that kept me going.
Made me try even harder and now, next time, it will be much easier to do everything if I decide to reinstall Windows.
Thank you for the vote of confidence, I have a very long road to go, people say that it takes 10k hours to be proficient in anything, I will just have to learn python one step at a time.
But, lucky, I have experience in software development since high school and University so, it won't be that hard.
Will keep you guys updated.
Take care and have a good one.

The @OriginalWorks bot has determined this post by @ideagenerator to be original material and upvoted it!

ezgif.com-resize.gif

To call @OriginalWorks, simply reply to any post with @originalworks or !originalworks in your message!

To enter this post into the daily RESTEEM contest, upvote this comment! The user with the most upvotes on their @OriginalWorks comment will win!

For more information, Click Here!
Special thanks to @reggaemuffin for being a supporter! Vote him as a witness to help make Steemit a better place!

Just reading all of yours,you,their post..talking about python,anaconda,baracuda....makes me dizzy already..cant imagine how frustrating it is..
I cant even install black ops 2 on my pc years ago,took me 2 days and i quit trying😂😂😂.
But..i did finish the game😂😂

Glad to hear you put that frustration to good use and showed them :)

Congrats on getting it to work! I'm on linux, so getting it to work was easier for me, but even i got a few errors.

Anyway, if you find the script to be very slow, change the RPC node. The default ones can be very slow. I never knew you could do that while i was writing my script, and so my script took minutes to run lol

Tahnk you.
Yes, it takes over 3 minuts to run, how would I change the RPC node?

Another way of doing things would be using SteemData, @furion's website which is pretty awesome! And already has a python library 😊

while initiating the Steem object, in this line:

s=Steem()

instead, pass the url of the RPC node in the Steem() method

so like this:

s=Steem("<RPCNodeUrl>")

Ok, thank, I will try that and the library from @furion 👍

Coin Marketplace

STEEM 0.27
TRX 0.13
JST 0.032
BTC 61451.22
ETH 2929.56
USDT 1.00
SBD 3.65