owenwater/alfred-cal

Error in workflow zmin.calendar

Closed this issue · 22 comments

I just tried the workflow this morning and I got this error:

Starting debug for 'Calendar'
 [ERROR: alfred.workflow.input.scriptfilter] Code 1: 09:14:33 workflow.py:1945 DEBUG    Workflow version : 1.2.0
09:14:33 workflow.py:1951 ERROR    No JSON object could be decoded
Traceback (most recent call last):
  File "workflow/workflow.py", line 1946, in run
    func(self)
  File "main.py", line 37, in main
    self.init_settings()
  File "main.py", line 27, in init_settings
    self.minus = self.wf.settings.setdefault('minus', self.minus_default)
  File "workflow/workflow.py", line 1378, in settings
    self._default_settings)
  File "workflow/workflow.py", line 802, in __init__
    self._load()
  File "workflow/workflow.py", line 813, in _load
    for key, value in json.load(file_obj, encoding='utf-8').items():
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 290, in load
    **kw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 351, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
09:14:33 workflow.py:1969 DEBUG    Workflow finished in 0.429 seconds.

Hi @politicus,

Looks like it caused by a broken JSON file. Can you paste the content of the file "~/Library/Application Support/Alfred 2/Workflow Data/zmin.calendar/settings.json"? Thanks a lot.

Also, a quick workaround is delete that file and back to the default settings. Please backup the file first if you have some important settings.

Owen

The .json file is empty.

Yes, an empty file will cause the issue. Deleting it shall solve the problem. I'll improve the code to solve this issue automatically in the future.
BTW, have you changed any configuration of the workflow recently? I'm so curious about what kind of thing can destroy the setting file.

Ok. Thank you.
No change at the configuration file. Had the workflow in my "buggy Alfred workflow you should try to make work".
Running calconfig -> error in workflow 'zmin.calendar'.

hmm, still can't figure out how that happened.
Anyway, thanks a lot for the ticket and please let me know if delete the file can't solve the issue.

Deleting the file can't solve the issue.

Interesting. What command have you typed after deleting? cal or calconfig? Or both of them failed?

And is a new setting file be generated after the command? is it still empty?

1°) cal then calconfig
2°)Yes a file is generated
3°) Yes it is empty

Can you try cal?

forget it

Hi @politicus

Sorry for the inconvenience. Can you paste the exception track again for the first time you run the command after deleting? Is it exactly same as before?

Owen

Hi @politicus

I need more time to figure out the reason as it's so weird. Since the deleting didn't work, can you try to type {} in the empty file instead?

Owen

Same error.

On 13 Jun 2015 at 18:25:17, Owen Min (notifications@github.com) wrote:

Can you try cal?


Reply to this email directly or view it on GitHub.

Hi @politicus

Sorry, didn't see you already tried cal already in your previous post.

Now I need more information for who creates the empty file because I can't find it by code. Can you paste the log file for:

  • deleting the settings.json -> type cal
  • deleting the settings.json -> type calconfig

Is there any other error message after the deleting?

Also, not sure if it's related, do you use default Alfred Workflow data directory or the custom one? For the data directory/setting.json file, do you got the read/write permission?

And, please try {} solution and tell me the result.

Owen

cal after deleting settings.json`:

Starting debug for 'Calendar'

[STDERR: alfred.workflow.input.scriptfilter] 08:29:48 workflow.py:1945 DEBUG    Workflow version : 1.2.0
08:29:59 workflow.py:2124 DEBUG    Set last run version : 1.2.0
08:29:59 workflow.py:1969 DEBUG    Workflow finished in 11.726 seconds.
[INFO: alfred.workflow.input.scriptfilter] <?xml version="1.0" encoding="utf-8"?>
<items><item valid="no"><title>                              June  2015                              </title><subtitle /></item><item valid="no"><title>    Su        Mo        Tu        We        Th        Fr        Sa    </title><subtitle /><icon>image/blank.png</icon></item><item valid="yes"><title>                01         02        03         04        05        06</title><subtitle /><arg>2015 6 01</arg><icon>image/biank.png</icon></item><item valid="yes"><title>    07        08         09        10         11        12        13</title><subtitle /><arg>2015 6 07</arg><icon>image/biank.png</icon></item><item valid="yes"><title>    &#9733;        15         16         17         18        19       20</title><subtitle /><arg>2015 6 &#9733;</arg><icon>image/biank.png</icon></item><item valid="yes"><title>    21        22         23        24         25        26        27</title><subtitle /><arg>2015 6 21</arg><icon>image/biank.png</icon></item><item valid="yes"><title>    28        29         30                                             </title><subtitle /><arg>2015 6 28</arg><icon>image/biank.png</icon></item></items>

calconfig after deleting settings.json:

[STDERR: alfred.workflow.input.scriptfilter] 08:33:46 workflow.py:1945 DEBUG    Workflow version : 1.2.0
08:33:47 workflow.py:2124 DEBUG    Set last run version : 1.2.0
08:33:47 workflow.py:1969 DEBUG    Workflow finished in 0.857 seconds.
[INFO: alfred.workflow.input.scriptfilter] <?xml version="1.0" encoding="utf-8"?>
<items><item autocomplete="width " valid="no"><title>Set width of the calendar</title><subtitle>Current: 10</subtitle></item><item autocomplete="minus " valid="no"><title>Set hotkey: showing previous month</title><subtitle>Current: &lt;</subtitle></item><item autocomplete="plus " valid="no"><title>Set hotkey: showing next month</title><subtitle>Current: &gt;</subtitle></item><item autocomplete="week " valid="no"><title>Set first day of a week</title><subtitle>Current: Sunday</subtitle></item><item autocomplete="config " valid="no"><title>Open config file</title><subtitle /></item></items>

I think the problem was a file permissions problem. By default, the .json file was a 644. When set to 755 the cal command works fine.

It seems like the .json file is generated as a 644. While the zmin.calendar folder is a 755 by default. I didn't need to change its permissions.

Interesting. Is there any IOError: [Errno 13] Permission denied in the early log file?

I don't think the workflow needs an execute permission of a JSON file. What's more, 022 shall be default umask value for most of Linux/Mac system. So it doesn't make too much sense to me logically. However, so glad it solves your problem.

No error like these one in the early log file.

I'm having the same issue. I don't have an Alfred 2 folder in Application support at all. Any suggestions on how to get that back?

No Alfred 2 folder in Users/[Your Username]/Library/Application support? Weird. As it is where your Alfred settings are set.

Just go the Alfred forums for an answer to your question.

Okay found it. My mistake. I was going to the library folder found on the root of the hdd.

Deleting the json file did the trick for me. It's working now. Thanks!

Hi @politicus and @shateredsoul ,

The problem is caused by alfred-workflow package. It has been resolved by the latest release. I will update the package soon.

Hi @politicus and @shateredsoul

The new version is able to download now, feel free to leave a message again if anything goes wrong.

Regards,
Owen