deanishe / alfred-convert

Convert between different units in Alfred

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Currency Conversions No Longer Working

seb-griffiths opened this issue · comments

I've entered a valid API_KEY as per the instructions but I am getting unknown unit for anything other than USD. Does anyone have any ideas?

2017-11-05_14-10-24

Can reproduce. Error began after upgrading to 3.2.1.

I can't reproduce this.

@sebcomputercat Please post the contents of the log file (Enter conv workflow:openlog into Alfred to view it.)

Screenshots aren't much help: I know what my workflow looks like.

I also tried downgrading to 3.2 and resetting the OER App ID but no luck.

17:10:25 convert.py:315 CRITICAL invalid query (1 usd hkd): Unknown unit: hkd
17:10:29 convert.py:323 CRITICAL No to_units (or defaults) for [currency]
17:10:30 convert.py:315 CRITICAL invalid query (1 usd vn): Unknown unit: vn
17:10:30 convert.py:315 CRITICAL invalid query (1 usd vnd): Unknown unit: vnd
17:10:35 convert.py:323 CRITICAL No to_units (or defaults) for [currency]
17:10:39 convert.py:315 CRITICAL invalid query (1 usd thb): Unknown unit: thb
17:10:40 convert.py:323 CRITICAL No to_units (or defaults) for [currency]
17:10:42 convert.py:315 CRITICAL invalid query (1 usd inr): Unknown unit: inr
17:10:45 convert.py:323 CRITICAL No to_units (or defaults) for [currency]
17:10:48 convert.py:328 CRITICAL invalid conversion (1 usd g): Cannot convert from 'USD' ([currency]) to 'gram' ([mass])
17:10:48 convert.py:315 CRITICAL invalid query (1 usd gbp): Unknown unit: gbp

@ttp2113 That's not enough information to diagnose the problem. Please post the log file (instructions immediately above).

Same thing happens to me after the update:

21:43:21 currency.py:247 INFO     fetching exchange rates from Yahoo! and CryptoCompare.com ...
21:43:22 background.py:180 INFO     [update] job already running
21:43:23 background.py:180 INFO     [update] job already running
21:43:24 background.py:180 INFO     [update] job already running
21:43:25 background.py:180 INFO     [update] job already running
21:43:26 background.py:180 INFO     [update] job already running
21:43:27 background.py:180 INFO     [update] job already running
21:43:28 background.py:180 INFO     [update] job already running
21:43:29 background.py:180 INFO     [update] job already running
21:43:30 background.py:180 INFO     [update] job already running
21:43:31 background.py:180 INFO     [update] job already running
21:43:32 background.py:180 INFO     [update] job already running
21:43:32 background.py:180 INFO     [update] job already running
21:43:33 background.py:180 INFO     [update] job already running
21:43:35 update.py:312 INFO     retrieving releases: deanishe/alfred-convert
21:43:35 update.py:353 INFO     15 releases for deanishe/alfred-convert
21:43:37 update.py:390 INFO     installing updated workflow ...
21:43:58 background.py:180 INFO     [update] job already running
21:43:58 convert.py:350 CRITICAL invalid query (350 ): No units specified
21:43:59 background.py:180 INFO     [update] job already running
21:43:59 convert.py:350 CRITICAL invalid query (350 ): No units specified
21:44:01 background.py:180 INFO     [update] job already running
21:44:01 convert.py:350 CRITICAL invalid query (350 chf try): Unknown unit: chf
21:44:02 background.py:180 INFO     [update] job already running
21:44:02 convert.py:350 CRITICAL invalid query (350 chf try): Unknown unit: chf
21:44:03 background.py:180 INFO     [update] job already running
21:44:03 convert.py:350 CRITICAL invalid query (350 chf try): Unknown unit: chf
21:44:04 background.py:180 INFO     [update] job already running
21:44:04 convert.py:350 CRITICAL invalid query (350 chf try): Unknown unit: chf
21:44:06 background.py:180 INFO     [update] job already running
21:44:06 convert.py:350 CRITICAL invalid query (350 chf try): Unknown unit: chf
21:44:06 background.py:180 INFO     [update] job already running
21:44:06 convert.py:350 CRITICAL invalid query (350 chf try): Unknown unit: chf
21:44:07 background.py:180 INFO     [update] job already running
21:44:07 convert.py:350 CRITICAL invalid query (350 chf try): Unknown unit: chf
21:44:09 background.py:180 INFO     [update] job already running
21:44:09 convert.py:350 CRITICAL invalid query (350 ): No units specified
21:44:10 background.py:180 INFO     [update] job already running
21:44:10 convert.py:350 CRITICAL invalid query (350 ): No units specified
21:44:11 workflow.py:2266 ERROR    HTTP Error 403: Forbidden
Traceback (most recent call last):
  File "/Users/feyyaz/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F7CEB59B-4078-45EF-BA6B-2F33FF79819E/workflow/workflow.py", line 2259, in run
    func(self)
  File "/Users/feyyaz/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F7CEB59B-4078-45EF-BA6B-2F33FF79819E/currency.py", line 251, in main
  File "/Users/feyyaz/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F7CEB59B-4078-45EF-BA6B-2F33FF79819E/workflow/workflow.py", line 1890, in cached_data
    data = data_func()
  File "/Users/feyyaz/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F7CEB59B-4078-45EF-BA6B-2F33FF79819E/currency.py", line 232, in fetch_exchange_rates
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 567, in get
    raise self._value
HTTPError: HTTP Error 403: Forbidden
21:44:12 convert.py:350 CRITICAL invalid query (350 try): Unknown unit: try
21:44:12 currency.py:204 INFO     fetching exchange rates from OpenExchangeRates.org and CryptoCompare.com ...
21:44:12 currency.py:113 WARNING  not fetching fiat currency exchange rates: APP_KEY for openexchangerates.org not set. Please sign up for a free account here: https://openexchangerates.org/signup/free
21:44:12 currency.py:213 INFO     24 exchange rates updated in 0.21 seconds.
21:44:13 convert.py:350 CRITICAL invalid query (350 try chf): Unknown unit: try
21:44:13 convert.py:350 CRITICAL invalid query (350 try chf): Unknown unit: try
21:45:44 convert.py:350 CRITICAL invalid query (300 ): No units specified
21:45:45 convert.py:350 CRITICAL invalid query (300 CHF t): Unknown unit: CHF
21:45:45 convert.py:350 CRITICAL invalid query (300 CHF try): Unknown unit: CHF
21:45:48 convert.py:350 CRITICAL invalid query (300 CHF TRY): Unknown unit: CHF
21:45:51 convert.py:350 CRITICAL invalid query (300): No units specified
21:45:52 convert.py:350 CRITICAL invalid query (300chf try): Unknown unit: chf
21:45:56 convert.py:350 CRITICAL invalid query (300): No units specified
21:53:28 convert.py:358 CRITICAL No to_units (or defaults) for [current] * [time]
21:53:28 convert.py:350 CRITICAL invalid query (350 eur chf): Unknown unit: eur
08:57:38 convert.py:350 CRITICAL invalid query (300 ): No units specified
08:57:38 currency.py:204 INFO     fetching exchange rates from OpenExchangeRates.org and CryptoCompare.com ...
08:57:38 currency.py:113 WARNING  not fetching fiat currency exchange rates: APP_KEY for openexchangerates.org not set. Please sign up for a free account here: https://openexchangerates.org/signup/free
08:57:38 currency.py:213 INFO     24 exchange rates updated in 0.31 seconds.
08:57:38 convert.py:350 CRITICAL invalid query (300 try chf): Unknown unit: try
08:57:39 convert.py:350 CRITICAL invalid query (300 try chf): Unknown unit: try

Could it be that it happens because of Yahoo Finance shutting down their API? https://news.ycombinator.com/item?id=15616880

Cryptocurrency conversions still work for me. @sebcomputercat @ttp2113 can you confirm?

EDIT: @deanishe nvm my Yahoo comment, I just saw that you're using openexchangerates.org

Having the same problem

I have no idea what has changed but today, this is working as it should. I'll leave the discussion open for a short while before closing as some appear to be having the issue still.

Great that it fixed itself for you.

Here is my log, @deanishe
https://pastebin.com/wPHWS8EF

@sebcomputercat

I have no idea what has changed but today

The cache expired and the workflow downloaded new exchange rates.

@freshfey Did you get it working? (The instructions are in the log you posted.)

@everybody If you've set APP_KEY, the problem is almost certainly because the workflow is working from an old cache of exchange rates (which only contains cryptocurrencies). v3.2.1 should delete any old caches on first run, but only if you've upgraded to it from a version below 3.1 (i.e. one that used Yahoo! Finance). If you updated from v3.2 to v3.2.1, it won't clear the cache, and you have to do it manually with conv workflow:delcache or wait until the workflow updates exchange rates again (every 6 hours by default).

@deanishe , I tried an upgrade from 3.0 to 3.2.1 and currency conversion works successfully. When I'm back at my other machine, I can try the cache delete or a downgrade to <3.2 followed up an upgrade to 3.2.1 to see if that addresses it.

@ttp2113 I've just released v3.2.2. That should show a useful warning if APP_KEY isn't set and properly clear the cache after it is.

But yeah, in any case conv workflow:delcache is a good starting point if you're having issues. (The same applies to many workflows based on Alfred-Workflow.)

@Alacho2 You appear to be using an old version of the workflow. Enter conv workflow:update to install the latest version and let me know if you're still having problems.

Also, I see you're using Google Drive to sync your Alfred.preferences. Please note that Google Drive and iCloud are not recommended for syncing:

Apple's iCloud and Google Drive have been unreliable options for many users, resulting in lost preferences or file conflicts, so we do not recommend them for syncing preferences.

@deanishe upgraded from 3.2 to 3.2.2 and everything is working. I am able to also verify that if APP_KEY is not set, that I am presented with a warning.

@ttp2113 Glad it’s working for you. Looks like 3.2.2 should behave correctly on update. Sorry for the dodgy versions.

@deanishe works now after setting APP_KEY 👍 Thanks!

@deanishe Perfect, now it's working!

For the record: I only use Google Drive to store the files. Not the sync, as I'm only in possession of one MacOS-product. :)

Seems to be working for everyone. I'll close this issue, then.