Jump to content

[SOLVED] Could not convert Fahrenheit to celcius in Script Filter


Recommended Posts

I was trying to write a simple workflow to convert farenheit to celcius and display in alfred using script filter.

 

Here is the workflow link.

 

Code:

 

 

import json
import sys


faren = float(sys.argv[1])

celcius = (faren - 32) * 5.0/9

data = {'valid': 'true', 
         'title': 'Farenheit to Celcius',
         'subtitle': str(celcius)
         }

data_lst = [data]


data = {"items": data_lst}
json.dump(data, sys.stdout)

 

Problem: It gives following error

IndexError: list index out of range

 

How to fix the error?

 

Thanks.

Edited by Bhishan
Link to comment

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
×
×
  • Create New...