Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run python script? #385

Closed
iamnaok opened this issue Jul 15, 2016 · 4 comments
Closed

How to run python script? #385

iamnaok opened this issue Jul 15, 2016 · 4 comments

Comments

@iamnaok
Copy link

iamnaok commented Jul 15, 2016

Hi, I cannot figure out how to run this script https://gist.github.com/mattvukas/9146611

Here it is:
import requests, json
from time import sleep

def getBitcoinPrice():
URL = 'https://www.bitstamp.net/api/ticker/'
try:
r = requests.get(URL)
priceFloat = float(json.loads(r.text)['last'])
return priceFloat
except requests.ConnectionError:
print "Error querying Bitstamp API"

while True:
print "Bitstamp last price: $" + str(getBitcoinPrice()) + "/BTC"
sleep(5)

@ddementieva
Copy link

When on the Dashboard, go to Workspaces > Stack Library and create a new workspace with Python2.7 stack. Open it in the IDE and create a new project with py file, which contains your script, and requirements.txt file with the following content Requests to install requests module.

In the Terminal, cd your project directory and execute the following command to run your script: sudo virtualenv /env && sudo pip install --upgrade pip && sudo pip install -r requirements.txt && python main.py

@ghost ghost added the kind/question label Jul 18, 2016
@ghost
Copy link

ghost commented Jul 20, 2016

@iamnaok does this suggestion help?

@ghost
Copy link

ghost commented Jul 27, 2016

Closing the issue - do try the suggestion offered by @ddementieva

@ghost ghost closed this as completed Jul 27, 2016
@thalesmaoa
Copy link

This suggestion doesn't work. Can you open this issue?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants