Python Forum
I need help understanding how to use and run this program! Thanks in advance!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help understanding how to use and run this program! Thanks in advance!
#1
Hi everyone! I am new here! I am trying to learn how to use python to run and use this code: https://github.com/petertodd/replace-by-fee-tools

If anyone could explain to me how to use this, I would really really appreciate it.

I already have the latest version of Python installed. I just don't really understand how to use the ./(name) to run the code.

Any help would be great!

Thanks a ton!
Reply
#2
(Aug-31-2017, 09:42 PM)tc1chosen Wrote: I just don't really understand how to use the ./(name) to run the code.

This is a way to run a script that is executable in linux. If you are on windows you could just run the script via python3.exe name.py in your command prompt

./bump-fee.py <txid> becomes python bump-fee.py <txid> where "python" is your python3.x interpreter
Recommended Tutorials:
Reply
#3
Hey tc1chosen,
They are trying to tell you a way you can run your script. I hope you are familiar with running python on command prompt(in windows) or on the terminal(in Linux). if not it just the reference to that. Now understand it this way

You saved your file at a particular location like d:/python_file.py and you want to run it then you will open command prompt, go to that location and run:
python python_file.py
Now, In case of Linux you open terminal, go to that location and run:
./python_file.py
[provided you wrote the 'shebang line']

So, This is basically the syntax to run that in a linux environment. :)

Hope this helps.
Reply
#4
(Aug-31-2017, 10:26 PM)metulburr Wrote: If you are on windows you could just run the script via python3.exe name.py in your command prompt
Changing name on python.exe is something that is not recommenced on Windows,and it's not necessary either.
All version that's installed can be run via py -version.
So 3.6 as main version in Path that run via python name.py.
All other version can be run like this.
# The main version in Path
C:\1>python version.py
3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [SC v.1900 32 bit (Intel)]

# Main pip
C:\1>pip -V
pip 9.0.1 from c:\python36\lib\site-packages (python 3.6)

# Run same file with 2.7
C:\1>py -2.7 version.py
2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)]

# Run same file with 3.4
C:\1>py -3.4 version.py
3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)]

# Using pip to install to 3.4
C:\1>py -3.4 -m pip install requests
Collecting requests
  Using cached requests-2.18.4-py2.py3-none-any.whl
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python34\lib\site-packages (from requests)
Installing collected packages: requests
Successfully installed requests-2.18.4

# If a version is not installed,will give a message
C:\1>py -3.1 version.py
Requested Python version (3.1) not installed
Reply
#5
Thanks for the response everyone! I have figured out how to run it.

I have run into an error though:

When i type in:
python doublespend.py
It gives me this error

Traceback (most recent call last):
  File "doublespend.py", line 10, in <module>
    import bitcoin.rpc
ImportError: No module named rpc
I have googled it and I cant find a module named bitcoin.rpc

I have already installed rpc (pip install rpc)



Any ideas?

Thanks a ton!
Reply
#6
You do use Windows?
The library is only tested in Linux.
If you click on the only folder in repo you are here.

To install:
pip install python-bitcoinlib

Requirements:
sudo apt-get install libssl-dev
This is a Linux only command,the Window equivalent is OpenSSL.
If it work bye installing OpenSSL on Windows is unsure.

I would have used Linux for this Repo,you can use VirtualBox with Linux distro if want to stay in Windows.
Reply
#7
(Sep-01-2017, 09:45 AM)snippsat Wrote: You do use Windows?
The library is only tested in Linux.
If you click on the only folder in repo you are here.

To install:
pip install python-bitcoinlib

Requirements:
sudo apt-get install libssl-dev
This is a Linux only command,the Window equivalent is OpenSSL.
If it work bye installing OpenSSL on Windows is unsure.

I would have used Linux for this Repo,you can use VirtualBox with Linux distro if want to stay in Windows.

Thank you for the response. I do believe that this is the issue. I will try it out with VB and let you know what happens!

Thanks!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  code won't advance to next statement MCL169 2 767 Apr-11-2023, 09:44 PM
Last Post: Larz60+
  I need help understanding a program structure using classes CompleteNewb 21 6,076 Feb-24-2022, 07:15 PM
Last Post: deanhystad
  Understanding program blocks newbieAuggie2019 2 1,987 Oct-02-2019, 06:22 PM
Last Post: newbieAuggie2019
  Advance program when certain keys are pressed? Chrislw324 2 2,351 May-19-2019, 07:13 PM
Last Post: woooee
  help with understanding a program prompt drasil 5 2,979 Feb-14-2019, 05:54 PM
Last Post: ichabod801
  Advance properties read from xml files python1234 0 2,432 Apr-25-2018, 01:42 PM
Last Post: python1234
  loop doesn't advance-py3 text game foxtreat 2 3,584 Jun-08-2017, 06:41 AM
Last Post: foxtreat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020