Jump to content
jason0x43

Weather workflow

Recommended Posts

I just posted a new version that fixes a small bug in the settings migration code. It would only have come up if you upgraded from the very first version of the settings to the current one. If you haven't had any problems, you aren't affected. 

Share this post


Link to post

Hmmm...I've tried this with several older versions of my settings file but I can't reproduce this error. Could you open up your settings file (at /Users/<you>/Library/Application Support/Alfred 2/Workflow Data/jc-weather/settings.json) and either post it or see if it looks like this? It's OK if you have additional settings, like key.fio, but you should have at least the ones below.

 

  {

    "key.wund": "<your key>",

    "service": "wund",

    "icons": "grzanka",

    "days": 3,

    "time_format": "%A, %B %d, %Y %I:%M%p",

    "version": 3,

    "location": {

      "latitude": 34.0522342,
      "timezone": "America/Los_Angeles",
      "longitude": -118.2436849,
      "name": "Los Angeles, California",

      "short_name": "Los Angeles"

    },

    "units": "si"

  }

Weird, it looks like this:

 

{
  "service": "wund", 
  "icons": "grzanka", 
  "key.fio": "88a6b92b8f6ecc59ccbbd8719f7e5f32", 
  "days": 5, 
  "time_format": "%a, %d %b %Y %H:%M", 
  "version": 2, 
  "location": {
    "latitude": 45.755539, 
    "timezone": "Europe/Bucharest", 
    "longitude": 21.237499, 
    "name": "Timisoara, Romania", 
    "short_name": "Timisoara"
  }, 
  "units": "si"
}

Share this post


Link to post

Ok, I see the problem, Your service is defined as Weather Underground, but you only have a key for forecast.io. I'm not entirely sure how it got into that state, but you should be able to fix it by running the "wset service" command again.

 

I've posted an updated version of the code that deals with this situation (by asking you to re-specify your service if the service key is missing).

Share this post


Link to post

Location setting isn't working for me either. I'm using Lion.

 

What happens is that when you go to 'wset location' and then type anything else, it auto fills it as a Google search.

 

Help?

 

MTIA

Share this post


Link to post

Location setting isn't working for me either. I'm using Lion.

 

What happens is that when you go to 'wset location' and then type anything else, it auto fills it as a Google search.

 

Help?

 

MTIA

 

It sounds like the script that the workflow uses to query location data is crashing, or at least returning bad data. Hmm...

 

Does the location you're trying to enter contain any non-ASCII characters, by chance?

Share this post


Link to post

It sounds like the script that the workflow uses to query location data is crashing, or at least returning bad data. Hmm...

 

Does the location you're trying to enter contain any non-ASCII characters, by chance?

 

Nope. I live in Washington, DC. I've tried to input that and my zip code. Neither works.

 

I even disabled Google searches just for yuks. Sadly, I was not laughing.

 

Thanks for the response. I've checked php and the other tricks listed in this thread. Everything else is fine.

 

Other ideas? Me wanna use dis workflow. :)

Share this post


Link to post

Nope. I live in Washington, DC. I've tried to input that and my zip code. Neither works.

 

I even disabled Google searches just for yuks. Sadly, I was not laughing.

 

Thanks for the response. I've checked php and the other tricks listed in this thread. Everything else is fine.

 

Other ideas? Me wanna use dis workflow. :)

 

It's never the easy answer. Ok, I'm looking into it. Could you tell me what version of Alfred you have?

Share this post


Link to post

2.0.3 (187)

 

 

MTIA!!

 

Do other commands work, like "wset units" or "wset service"?

 

If you type in "wset location washington dc" (exactly that, without the quotes), does it work?

Share this post


Link to post

Do other commands work, like "wset units" or "wset service"?

 

If you type in "wset location washington dc" (exactly that, without the quotes), does it work?

 

'wset units' and 'wset service' work just fine. I even put in my WU api key without a problem. :)

 

If I do 'wset location' it will pull up the command, and then as soon as I type anything else, it drops to a Google search. This occurs right after entering a space between "location" and any other keystroke.

 

Hope that helps!

Share this post


Link to post

'wset units' and 'wset service' work just fine. I even put in my WU api key without a problem. :)

 

If I do 'wset location' it will pull up the command, and then as soon as I type anything else, it drops to a Google search. This occurs right after entering a space between "location" and any other keystroke.

 

Hope that helps!

 

Hmmm...  Just to make sure, are you using a recent version? (Like, did you download it in the last day or two from this thread or from the github page?)

 

I'm going to upload a new version with some debug code in a little while--I'll let you know when that's ready. That should make diagnosing this a bit easier.

Share this post


Link to post

'wset units' and 'wset service' work just fine. I even put in my WU api key without a problem. :)

 

If I do 'wset location' it will pull up the command, and then as soon as I type anything else, it drops to a Google search. This occurs right after entering a space between "location" and any other keystroke.

 

Hope that helps!

 

Ok, I just uploaded a new version with some debug logging. That should make diagnosing the problem a bit easier. Just use the download link in the first post in this thread and install the workflow.

 

First, try running "wset location" again. The workflow will create a new file in the workflow directory called "debug.log" that logs all the Weather commands you've run for the last hour, including exceptions. You can get to the file by:

  1. Open Alfred's preferences
  2. Click on Workflows at the top of the pane
  3. Select the Weather workflow
  4. Double click on one of the command boxes in the workflow area (any one of the ones with the stormy icon)
  5. Click on the "Open workflow folder" button at the bottom of the info pane that appears

That will open a Finder window at the workflow folder. You should see a file called debug.log. Hopefully it will shed some light on the problem. Just paste its contents into a new message here.

Share this post


Link to post

Which command gives you that error?

it works now, i rebooted. o:

 

idk what caused it. but just getting the weather normally caused it.

Share this post


Link to post

it works now, i rebooted. o:

 

idk what caused it. but just getting the weather normally caused it.

 

Ok, glad to hear it's working. I uploaded a new version of the workflow that does some debug logging in the background. If you install that one, it could help figure out narrow down the source of the problem if it comes up again.

Share this post


Link to post

Uhm, okay. I just tried this, and while wset location now gives me a brief pause before it drops to Google search it's not producing a debug.log at all.  : /

 

I ran some of the other settings and they didn't produce the file either. IDK if that's because they weren't buggy tho. I also completely started from scratch, including restarting Alfred, and tried it again. Lastly, I set Finder to show hidden files jic I missed it.

 

 

I'm a wee bit more lost now. Thanks for your help though. I appreciate it!!

Edited by Jules

Share this post


Link to post

Uhm, okay. I just tried this, and while wset location now gives me a brief pause... before it drops to Google search, and it's not producing a debug.log at all.  : /

 

I ran some of the other settings and they didn't produce the file either. I completely started from scratch, including restarting Alfred, and tried it again. Lastly, I set Finder to show hidden files jic I missed it.

 

 

I'm a wee bit more lost now. Thanks for your help though. I appreciate it!!

Hmmm...that was kind of a messy process I gave you there. Ok, let me make a couple more updates and I'll get back to you.

Share this post


Link to post

Uhm, okay. I just tried this, and while wset location now gives me a brief pause before it drops to Google search it's not producing a debug.log at all.  : /

 

I ran some of the other settings and they didn't produce the file either. IDK if that's because they weren't buggy tho. I also completely started from scratch, including restarting Alfred, and tried it again. Lastly, I set Finder to show hidden files jic I missed it.

 

 

I'm a wee bit more lost now. Thanks for your help though. I appreciate it!!

 

I posted another update to the workflow. This one includes a new "wset log" command that will open a window for you that displays the debug log. Download and install this new version, run "wset location", and then run "wset log". That should pop up a window that shows the debug log, and you can copy-and-paste from that.

 

Just out of curiosity, what happens if you use an argument with the "weather" command, like "weather 20001" or "weather dc"? When you add an argument after "weather", it will take a few seconds to update.

Share this post


Link to post

Okay! Now we're in bidness. :)

 

FTR, when I just type in "weather 20008' as you suggest, I get the "Missing Default Location". I gather that's not surprising though. heh

 

Here's my default.log output:

 

[2013-05-24 09:33:28,441] INFO: alfred_weather: Running command weather
[2013-05-24 09:33:28,491] INFO: requests.packages.urllib3.connectionpool: Starting new HTTPS connection (1): api.forecast.io
[2013-05-24 09:33:29,450] DEBUG: requests.packages.urllib3.connectionpool: "GET /forecast/e5fcbcead283e722cd25de9c62507d63/39.8208925,-84.0193789?units=us HTTP/1.1" 200 None
[2013-05-24 10:33:09,778] INFO: alfred_weather: Running command location
[2013-05-24 10:33:09,779] DEBUG: alfred_weather: Getting location(s) with query "2"
[2013-05-24 10:33:09,811] INFO: requests.packages.urllib3.connectionpool: Starting new HTTP connection (1): autocomplete.wunderground.com
[2013-05-24 10:33:09,959] ERROR: alfred_weather: Error telling
Traceback (most recent call last):
  File "alfred_weather.py", line 807, in tell
    items = globals()[cmd](query)
  File "alfred_weather.py", line 665, in tell_location
    results = wunderground.autocomplete(query)
  File "wunderground.py", line 52, in autocomplete
    return requests.get(url).json()['RESULTS']
  File "requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "requests/sessions.py", line 279, in request
    resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
  File "requests/sessions.py", line 374, in send
    r = adapter.send(request, **kwargs)
  File "requests/adapters.py", line 209, in send
    raise ConnectionError(e)
ConnectionError: HTTPConnectionPool(host='autocomplete.wunderground.com', port=80): Max retries exceeded with url: /aq?query=2 (Caused by <class 'socket.error'>: [Errno 64] Host is down)
[2013-05-24 10:33:10,849] INFO: alfred_weather: Running command location
[2013-05-24 10:33:10,849] DEBUG: alfred_weather: Getting location(s) with query "20008"
[2013-05-24 10:33:10,883] INFO: requests.packages.urllib3.connectionpool: Starting new HTTP connection (1): autocomplete.wunderground.com
[2013-05-24 10:33:10,886] ERROR: alfred_weather: Error telling
Traceback (most recent call last):
  File "alfred_weather.py", line 807, in tell
    items = globals()[cmd](query)
  File "alfred_weather.py", line 665, in tell_location
    results = wunderground.autocomplete(query)
  File "wunderground.py", line 52, in autocomplete
    return requests.get(url).json()['RESULTS']
  File "requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "requests/sessions.py", line 279, in request
    resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)
  File "requests/sessions.py", line 374, in send
    r = adapter.send(request, **kwargs)
  File "requests/adapters.py", line 209, in send
    raise ConnectionError(e)
ConnectionError: HTTPConnectionPool(host='autocomplete.wunderground.com', port=80): Max retries exceeded with url: /aq?query=20008 (Caused by <class 'socket.error'>: [Errno 64] Host is down)

 

 

 

This is pretty Greek (or geek, if you will heh), but I gather WU isn't letting me connect. Am I reading that right?

Share this post


Link to post

Okay! Now we're in bidness. :)

 

FTR, when I just type in "weather 20008' as you suggest, I get the "Missing Default Location". I gather that's not surprising though. heh

 

Here's my default.log output:

 

 

 

This is pretty Greek (or geek, if you will heh), but I gather WU isn't letting me connect. Am I reading that right?

 

Yup, that does seem to be the case. What happens if you try to go to http://autocomplete.wunderground.com/aq?query=20001 in a web browser? You should get back the following text:

{ "RESULTS": [ { "name": "20001 - Washington, DC", "type": "city", "c": "US", "zmw": "20001.1.99999", "tz": "America/New_York", "tzs": "EDT", "l": "/q/zmw:20001.1.99999" } ] }
Edited by jason0x43

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×