Hi there,
I've recently set up a mysql database and have been able to write to it on a separate python file. I am trying to call to said database in a separate python script, but I am not able to call to it. The script works locally on my desktop for an identical mysql database, so not sure why I can't get PythonAnywhere to pull in entries.
Error:
Traceback (most recent call last):
File "/home/xxxx/current_price.py", line 191, in <module>
get_data()
File "/home/xxxx/current_price.py", line 152, in get_data
daily_close = close[a]
IndexError: list index out of range
Code:
db=MySQLdb.connect(host=HOST, user=USER, passwd=PASSWD, db=DATABASE, charset="utf8")
cursor = db.cursor()
cursor.execute('SELECT * FROM ' + str(key_val[pair]).lower() + '_ohlc ORDER BY time DESC limit 500') #query in
table
row = cursor.fetchall() # fetch next row
i = 0
open = []
close = []
print(row)