I have read and attempted the answers here in stackoverflow but still cant seem to get this to work. Im have a file global.py and a file weather.py. Global holds the variables for parsing a url and storing the global in that file like this:
f = urllib2.urlopen( http://api.wunderground.com/api/MYAPI/forecast/q/04002.json ) json_string = f.read() parsed_json = json.loads(json_string) #location = parsed_json[ location ][ city ] day0 = parsed_json["forecast"]["simpleforecast"]["forecastday"][0] day1 = parsed_json["forecast"]["simpleforecast"]["forecastday"][1] day2 = parsed_json["forecast"]["simpleforecast"]["forecastday"][2] dayname_0 = day0[ date ][ weekday_short ] high_0 = day0[ high ][ fahrenheit ]
and here is my weather.py file
from PyQt4.QtCore import Qt from PyQt4.QtGui import QWidget, QApplication, QSplitter, QLabel, QVBoxLayout, QColor import Adafruit_DHT import urllib2 import wunderground temp = QLabel("Todays High: %s" % (high_0), self)
When i run the code i get the error that global name high_0 is not defined. What am i doing wrong. When i import the wunderground at the top does that not give me the globals from that file as well?