deanishe / alfred-convert

Convert between different units in Alfred
Other
721 stars 56 forks source link

Error in workflow 'Convert' - Division by zero #44

Closed Laerciogj closed 6 years ago

Laerciogj commented 6 years ago

After the last update v3.5.1, I can convert anymore the following error appear.

Error

Debug log `Starting debug for 'Convert'

[2018-03-11 21:42:23][ERROR: input.scriptfilter] Code 1: 21:42:23 workflow.py:2247 DEBUG ---------- Convert (3.5.1) ---------- 21:42:23 workflow.py:1657 DEBUG reading settings from /Users/Ray420/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-convert/settings.json 21:42:23 workflow.py:2526 INFO checking for update ... 21:42:23 background.py:188 DEBUG [workflow_update_check] command cached: /Users/Ray420/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-convert/workflow_update_check.argcache 21:42:23 background.py:192 DEBUG [workflow_update_check] passing job to background runner: [u'/usr/bin/python', '/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/workflow/background.pyc', u'workflow_update_check'] 21:42:23 workflow.py:2247 DEBUG ---------- Convert (3.5.1) ---------- 21:42:23 background.py:197 DEBUG [workflow_update_check] background job started 21:42:23 convert.py:625 DEBUG query : 12 usd jpy 21:42:23 workflow.py:2411 DEBUG last run version: 3.5.1 21:42:23 convert.py:103 DEBUG version=3.5.1, last_version=3.5.1 21:42:23 workflow.py:1884 DEBUG loading cached data: /Users/Ray420/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-convert/workflow_update_status.cpickle 21:42:23 workflow.py:2461 DEBUG update_data: {u'available': False} 21:42:23 workflow.py:1884 DEBUG loading cached data: /Users/Ray420/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-convert/exchange_rates.cpickle 21:42:23 convert.py:530 DEBUG registering currency : 'DZD = usd / 114.04071 = dzd' 21:42:23 convert.py:530 DEBUG registering currency : 'NAD = usd / 11.915 = nad' 21:42:23 convert.py:530 DEBUG registering currency : 'GHS = usd / 4.46 = ghs' 21:42:23 convert.py:530 DEBUG registering currency : 'EGP = usd / 17.641 = egp' 21:42:23 convert.py:530 DEBUG registering currency : 'BGN = usd / 1.58816 = bgn' 21:42:23 convert.py:530 DEBUG registering currency : 'LSK = usd / 0.05168 = lsk' 21:42:23 convert.py:530 DEBUG registering currency : 'PAB = usd / 1 = pab' 21:42:23 convert.py:530 DEBUG registering currency : 'BOB = usd / 6.910011 = bob' 21:42:23 convert.py:530 DEBUG registering currency : 'DKK = usd / 6.04549 = dkk' 21:42:23 convert.py:530 DEBUG registering currency : 'BWP = usd / 9.578914 = bwp' 21:42:23 convert.py:530 DEBUG registering currency : 'LBP = usd / 1512.5 = lbp' 21:42:23 convert.py:530 DEBUG registering currency : 'TZS = usd / 2254.1 = tzs' 21:42:23 convert.py:530 DEBUG registering currency : 'VND = usd / 22752.44336 = vnd' 21:42:23 convert.py:530 DEBUG registering currency : 'AOA = usd / 215.1155 = aoa' 21:42:23 convert.py:530 DEBUG registering currency : 'KHR = usd / 4002' 21:42:23 convert.py:530 DEBUG registering currency : 'QAR = usd / 3.641996 = qar' 21:42:23 convert.py:530 DEBUG registering currency : 'KYD = usd / 0.832789' 21:42:23 convert.py:530 DEBUG registering currency : 'LYD = usd / 1.33 = lyd' 21:42:23 convert.py:530 DEBUG registering currency : 'UAH = usd / 26.5275 = uah' 21:42:23 convert.py:530 DEBUG registering currency : 'JOD = usd / 0.709001 = jod' 21:42:23 convert.py:530 DEBUG registering currency : 'AWG = usd / 1.786505 = awg' 21:42:23 convert.py:530 DEBUG registering currency : 'SAR = usd / 3.75015 = sar' 21:42:23 convert.py:530 DEBUG registering currency : 'BND = usd / 1.321966 = bnd' 21:42:23 convert.py:530 DEBUG registering currency : 'HKD = usd / 7.830598 = hkd' 21:42:23 convert.py:530 DEBUG registering currency : 'CHF = usd / 0.93757 = chf' 21:42:23 convert.py:530 DEBUG registering currency : 'GIP = usd / 0.724428 = gip' 21:42:23 convert.py:530 DEBUG registering currency : 'XPF = usd / 96.875298 = xpf' 21:42:23 convert.py:530 DEBUG registering currency : 'XPD = usd / 38.77 = xpd' 21:42:23 convert.py:530 DEBUG registering currency : 'DASH = usd / 0.001649 = dash' 21:42:23 convert.py:530 DEBUG registering currency : 'MRO = usd / 356 = mro' 21:42:23 convert.py:530 DEBUG registering currency : 'HRK = usd / 6.038184 = hrk' 21:42:23 convert.py:530 DEBUG registering currency : 'DJF = usd / 177.075 = djf' 21:42:23 convert.py:530 DEBUG registering currency : 'THB = usd / 31.4465 = thb' 21:42:23 convert.py:530 DEBUG registering currency : 'XAF = usd / 532.515732 = xaf' 21:42:23 convert.py:530 DEBUG registering currency : 'XAG = usd / 0.06061195 = xag' 21:42:23 convert.py:530 DEBUG registering currency : 'ETB = usd / 27.56 = etb' 21:42:23 convert.py:530 DEBUG registering currency : 'UYU = usd / 28.40176 = uyu' 21:42:23 convert.py:530 DEBUG registering currency : 'NIO = usd / 31.085 = nio' 21:42:23 convert.py:530 DEBUG registering currency : 'LAK = usd / 8305 = lak' 21:42:23 convert.py:530 DEBUG registering currency : 'MAID = usd / 2.43 = maid' 21:42:23 convert.py:530 DEBUG registering currency : 'SYP = usd / 514.98999 = syp' 21:42:23 convert.py:530 DEBUG registering currency : 'MAD = usd / 9.2 = mad' 21:42:23 convert.py:530 DEBUG registering currency : 'MZN = usd / 61.855 = mzn' 21:42:23 convert.py:530 DEBUG registering currency : 'YER = usd / 250.325 = yer' 21:42:23 convert.py:530 DEBUG registering currency : 'ZAR = usd / 11.9234 = zar' 21:42:23 convert.py:530 DEBUG registering currency : 'NPR = usd / 104.297226 = npr' 21:42:23 convert.py:530 DEBUG registering currency : 'ZWL = usd / 322.355011 = zwl' 21:42:23 convert.py:530 DEBUG registering currency : 'NGN = usd / 360.5 = ngn' 21:42:23 convert.py:530 DEBUG registering currency : 'ANG = usd / 1.784194 = ang' 21:42:23 convert.py:530 DEBUG registering currency : 'CRC = usd / 569.71 = crc' 21:42:23 convert.py:530 DEBUG registering currency : 'AED = usd / 3.673014 = aed' 21:42:23 convert.py:530 DEBUG registering currency : 'GBP = usd / 0.724428 = gbp' 21:42:23 convert.py:530 DEBUG registering currency : 'MWK = usd / 725.725 = mwk' 21:42:23 convert.py:530 DEBUG registering currency : 'LKR = usd / 155.13 = lkr' 21:42:23 convert.py:530 DEBUG registering currency : 'DOP = usd / 49.13 = dop' 21:42:23 convert.py:530 DEBUG registering currency : 'PKR = usd / 110.65 = pkr' 21:42:23 convert.py:530 DEBUG registering currency : 'HUF = usd / 254.6475 = huf' 21:42:23 convert.py:530 DEBUG registering currency : 'BMD = usd / 1 = bmd' 21:42:23 convert.py:530 DEBUG registering currency : 'LSL = usd / 11.91 = lsl' 21:42:23 convert.py:530 DEBUG registering currency : 'MNT = usd / 2390.948643 = mnt' 21:42:23 convert.py:530 DEBUG registering currency : 'AMD = usd / 480.77 = amd' 21:42:23 convert.py:530 DEBUG registering currency : 'UGX = usd / 3648.3 = ugx' 21:42:23 convert.py:530 DEBUG registering currency : 'XDR = usd / 0.689644 = xdr' 21:42:23 convert.py:530 DEBUG registering currency : 'JMD = usd / 127.1499 = jmd' 21:42:23 convert.py:530 DEBUG registering currency : 'TTD = usd / 6.73915 = ttd' 21:42:23 convert.py:530 DEBUG registering currency : 'SHP = usd / 0.724428 = shp' 21:42:23 convert.py:530 DEBUG registering currency : 'AFN = usd / 69.475 = afn' 21:42:23 convert.py:530 DEBUG registering currency : 'MMK = usd / 1339.7 = mmk' 21:42:23 convert.py:530 DEBUG registering currency : 'KPW = usd / 900 = kpw' 21:42:23 convert.py:530 DEBUG registering currency : 'MKD = usd / 49.983876 = mkd' 21:42:23 convert.py:530 DEBUG registering currency : 'TRY = usd / 3.806784 = try' 21:42:23 convert.py:530 DEBUG registering currency : 'BDT = usd / 82.977763 = bdt' 21:42:23 convert.py:530 DEBUG registering currency : 'SJCX = usd / 0 = sjcx' 21:42:23 workflow.py:2266 ERROR division by zero Traceback (most recent call last): File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/workflow/workflow.py", line 2259, in run func(self) File "convert.py", line 645, in main register_exchange_rates(exchange_rates) File "convert.py", line 531, in register_exchange_rates ureg.define(definition) File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/registry.py", line 233, in define self._define(Definition.from_string(line)) File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/definitions.py", line 57, in from_string return UnitDefinition(name, symbol, aliases, value) File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/definitions.py", line 117, in init__ converter = ParserHelper.from_string(converter) File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/util.py", line 417, in from_string return cls._from_string(input_string) File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/compat/lrucache.py", line 129, in wrapper result = user_function(*args, **kwds) File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/util.py", line 452, in _from_string ret = build_eval_tree(gen).evaluate(cls.eval_token) File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/pint_eval.py", line 83, in evaluate return bin_op[op_text](left, self.right.evaluate(define_op, bin_op, un_op)) File "/Users/Ray420/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.36A4E12B-412E-4E74-90C4-60B1FD3B8E86/pint/util.py", line 535, in truediv__ new.scale /= other ZeroDivisionError: division by zero 21:42:23 workflow.py:2268 INFO for assistance, see: https://github.com/deanishe/alfred-convert/issues 21:42:23 workflow.py:2289 DEBUG ---------- finished in 0.382s ----------`

deanishe commented 6 years ago

That's a strange error. Can you run conv workflow:delcache to clear the cached list of exchange rates and then try again?

Going by your log, jpy isn't actually defined, so an error is to be expected. But you should be getting "Unknown unit: jpy" in Alfred, not a ZeroDivisionError.

Laerciogj commented 6 years ago

After cleaning the cached list everything is working as suppose to.I still have no idea what was causing the problem but now it's working! Thank you very much @deanishe 👏

deanishe commented 6 years ago

👍