Bitcoin Forum
May 13, 2024, 11:29:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: runnign python  (Read 791 times)
mokimarket (OP)
Sr. Member
****
Offline Offline

Activity: 422
Merit: 250



View Profile
April 26, 2013, 07:06:56 PM
 #1

Ok so lets say I just want to copy/paste and use this script: http://pastebin.com/Xu64wH1e

What do I need to install in order to execute python code? I'm working on a windows machine.
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 26, 2013, 07:54:58 PM
 #2

You would need the Python interpreter, it comes as an installer or zip, I recommend the installer. There is a 32-bit version and a 64-bit one, use whichever suits you. That should be all, unless that script depends on modules not part of standard Python.

http://www.python.org/download/

The Python installer associates .py files with Python so double clicking will execute them, or you can do it the old fashion and recommended way

Code:
python mypythonfile.py

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
mokimarket (OP)
Sr. Member
****
Offline Offline

Activity: 422
Merit: 250



View Profile
April 26, 2013, 09:05:55 PM
 #3

You would need the Python interpreter, it comes as an installer or zip, I recommend the installer. There is a 32-bit version and a 64-bit one, use whichever suits you. That should be all, unless that script depends on modules not part of standard Python.

http://www.python.org/download/

The Python installer associates .py files with Python so double clicking will execute them, or you can do it the old fashion and recommended way

Code:
python mypythonfile.py

Ok I executed the code, and the black screen appears and disappears. How can I determine if something actually happened? Can you send me a sample code that actually does something that I can see? Even "Hello World" but something that pull back from btc would be nice. Thanks.
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 26, 2013, 10:01:18 PM
 #4

You would need the Python interpreter, it comes as an installer or zip, I recommend the installer. There is a 32-bit version and a 64-bit one, use whichever suits you. That should be all, unless that script depends on modules not part of standard Python.

http://www.python.org/download/

The Python installer associates .py files with Python so double clicking will execute them, or you can do it the old fashion and recommended way

Code:
python mypythonfile.py

Ok I executed the code, and the black screen appears and disappears. How can I determine if something actually happened? Can you send me a sample code that actually does something that I can see? Even "Hello World" but something that pull back from btc would be nice. Thanks.
Try it from the console then. As in open a new command prompt, navigate to where the python script is and execute the code I gave above.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1032



View Profile WWW
April 27, 2013, 01:30:14 PM
 #5

I would suggest that if you don't have the skill to read arbitrary code from the Internet and understand it, especially if the author is targeting Bitcoin users, that you do not run such code on your computer - it could as easily have obfuscated "upload wallet.dat to hacker" code.

The code snippet you linked is for executing a trade on btc-e, you must do more than just click on it, it requires your api key and secret key be added to the code, and you must use command-line parameters to specify what currency and type of order you wish to execute. It says that on line four of the code. Original thread: https://bitcointalk.org/index.php?topic=97359.msg1075244#msg1075244

All that is needed is to download and install Python. For Windows: http://www.python.org/ftp/python/2.7/python-2.7.msi

The code only requires standard libraries, but you may find other advanced code that require other common-but-not-included libraries, such as greenlet, twisted, zope, boost, etc.

Here is some code which takes command line options; try saving this as example.py and running it from the command line. Master this first:

import sys; print ' '.join(sys.argv)
mokimarket (OP)
Sr. Member
****
Offline Offline

Activity: 422
Merit: 250



View Profile
April 28, 2013, 11:19:44 PM
 #6

I would suggest that if you don't have the skill to read arbitrary code from the Internet and understand it, especially if the author is targeting Bitcoin users, that you do not run such code on your computer - it could as easily have obfuscated "upload wallet.dat to hacker" code.

The code snippet you linked is for executing a trade on btc-e, you must do more than just click on it, it requires your api key and secret key be added to the code, and you must use command-line parameters to specify what currency and type of order you wish to execute. It says that on line four of the code. Original thread: https://bitcointalk.org/index.php?topic=97359.msg1075244#msg1075244

All that is needed is to download and install Python. For Windows: http://www.python.org/ftp/python/2.7/python-2.7.msi

The code only requires standard libraries, but you may find other advanced code that require other common-but-not-included libraries, such as greenlet, twisted, zope, boost, etc.

Here is some code which takes command line options; try saving this as example.py and running it from the command line. Master this first:

import sys; print ' '.join(sys.argv)

Man none of this stuff is working for me, I installed python33 and it keeps giving me errors. Can someone ELI5 how to pull data from btc-e. Willing to tip for your efforts.
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1032



View Profile WWW
April 29, 2013, 10:44:21 AM
 #7

Man none of this stuff is working for me, I installed python33 and it keeps giving me errors. Can someone ELI5 how to pull data from btc-e. Willing to tip for your efforts.

I didn't link to python 3.3 above, so "none of this stuff is working" would not be stuff I posted. Most python programming is still done on 2.7, because libraries for 3+ are limited.
mokimarket (OP)
Sr. Member
****
Offline Offline

Activity: 422
Merit: 250



View Profile
April 29, 2013, 11:02:33 AM
 #8

Man none of this stuff is working for me, I installed python33 and it keeps giving me errors. Can someone ELI5 how to pull data from btc-e. Willing to tip for your efforts.

I didn't link to python 3.3 above, so "none of this stuff is working" would not be stuff I posted. Most python programming is still done on 2.7, because libraries for 3+ are limited.

Gotcha, thanks for your time btw. Sorry I'm a bit frustrated because I always suck at learning a new programming language. Once I can get a somewhat complicated programs running I can usually figure everything else out. Only thing I've been able to do so far in python is "Hello World" Sad

Is there like a simple programs to just pull the last traded price from btc-e that I can try just for a test? I want to see if I can run an interactive program.
Jaxkr
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


View Profile
May 17, 2013, 04:58:48 AM
 #9

Man none of this stuff is working for me, I installed python33 and it keeps giving me errors. Can someone ELI5 how to pull data from btc-e. Willing to tip for your efforts.

I didn't link to python 3.3 above, so "none of this stuff is working" would not be stuff I posted. Most python programming is still done on 2.7, because libraries for 3+ are limited.

Gotcha, thanks for your time btw. Sorry I'm a bit frustrated because I always suck at learning a new programming language. Once I can get a somewhat complicated programs running I can usually figure everything else out. Only thing I've been able to do so far in python is "Hello World" Sad

Is there like a simple programs to just pull the last traded price from btc-e that I can try just for a test? I want to see if I can run an interactive program.
Well, you could scrape the web page using Beautiful Soup to get the data from btc-e and into your script.
EDIT: Actually, just use the API. No scraping required.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!