0

I am trying to get stock information for a particular ticker, and having issues with implementing the code in Linux Ubuntu in a virtual environment. I am getting the error below:

ValueError: No JSON object could be decoded

What's strange is I am not getting the same error when I am running the same code in the iOS terminal. Please see my code below for more details.

import json, urllib2

link_base = "http://www.google.com/finance?&q="
link_tick = "MU"
link_read = urllib2.urlopen(link_base+link_tick).read()
link_data = json.loads(link_read[3:])
link_info = link_data[0]

price = float(link_info["el"])

print price

Could someone explain to me why this is happening, and what I can change in my code to fix the issue in Linux Ubuntu?

troymyname00
  • 670
  • 1
  • 14
  • 32

0 Answers0