Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The expression could not be evaluated (task-2.4.0-1) #181

Closed
bmbove opened this issue Jan 10, 2015 · 6 comments
Closed

The expression could not be evaluated (task-2.4.0-1) #181

bmbove opened this issue Jan 10, 2015 · 6 comments

Comments

@bmbove
Copy link
Contributor

bmbove commented Jan 10, 2015

After upgrading taskwarrior to 2.4.0-1, I receive the following when running bugwarrior-pull:

INFO:bugwarrior:Service-defined UDAs (you can optionally add these to your ~/.taskrc for use in reports):
INFO:bugwarrior:uda.tracurl.type=string
INFO:bugwarrior:uda.tracurl.label=Trac URL
INFO:bugwarrior:uda.tracnumber.type=numeric
INFO:bugwarrior:uda.tracnumber.label=Trac Number
INFO:bugwarrior:uda.tracsummary.type=string
INFO:bugwarrior:uda.tracsummary.label=Trac Summary
CRITICAL:command:oh noes
TRACE Traceback (most recent call last):
TRACE File "/usr/lib/python2.7/site-packages/bugwarrior/command.py", line 49, in pull
TRACE synchronize(issue_generator, config)
TRACE File "/usr/lib/python2.7/site-packages/bugwarrior/db.py", line 330, in synchronize
TRACE 'closed': get_managed_task_uuids(tw, key_list, legacy_matching),
TRACE File "/usr/lib/python2.7/site-packages/bugwarrior/db.py", line 108, in get_managed_task_uuids
TRACE ('status', 'waiting'),
TRACE File "/usr/lib/python2.7/site-packages/taskw/warrior.py", line 590, in filter_tasks
TRACE _query_args
TRACE File "/usr/lib/python2.7/site-packages/taskw/warrior.py", line 489, in _get_task_objects
TRACE json = self._get_json(_args)
TRACE File "/usr/lib/python2.7/site-packages/taskw/warrior.py", line 484, in _get_json
TRACE encoded = self._execute(*args)[0]
TRACE File "/usr/lib/python2.7/site-packages/taskw/warrior.py", line 479, in _execute
TRACE raise TaskwarriorError(command, stderr, stdout, proc.returncode)
TRACE TaskwarriorError: ['task', 'rc:/home/brian/.taskrc', 'rc.uda.tracurl.type=string', 'rc.uda.tracurl.label="Trac URL"', 'rc.uda.tracnumber.type=numeric', 'rc.uda.tracnumber.label="Trac Number"', 'rc.uda.tracsummary.type=string', 'rc.uda.tracsummary.label="Trac Summary"', 'rc.json.array=TRUE', 'rc.confirmation=no', 'rc.verbose=nothing', 'export', '(tracurl.not:"")', '(status:"pending" or status:"waiting")'] #2; stderr:"The expression could not be evaluated."; stdout:""

Downgrading to task-2.3.0-4 seemed to fix this. I've played around with taskwarrior, and it seems to be related to this change in e9bdb67:

1169|     : - rhs.attribute ("raw", value);
     |1170: + rhs.attribute ("raw", "'" + value + "'");

taskwarrior/task@e9bdb67#diff-5dd069e991ecb94bdf07ac7e0f499470R877

Changing that line back makes bugwarrior work just fine. I'm wasn't sure if it was a problem with taskwarrior, or if bugwarrior needs to be adapted to this change; I don't know enough about the filter syntax to make that call. Looking at that change though, it seems it makes it impossible to check for an empty value, as a ("") is going to be quoted again, and it it doesn't seem to accept something like "(tracurl.not:)".

@bmbove
Copy link
Contributor Author

bmbove commented Jan 10, 2015

Changing (tracurl.not:"") to (tracurl.any) also works for that particular filter.

In db.py:

def get_managed_task_uuids(tw, key_list, legacy_matching):
    expected_task_ids = set([])
    for keys in key_list.values():
        tasks = tw.filter_tasks({
-            'and': [('%s.not' % key, '') for key in keys],
+            'and': [('%s.any' % key, None) for key in keys],
            'or': [
                ('status', 'pending'),
                ('status', 'waiting'),
            ],
        })
        expected_task_ids = expected_task_ids | set([
            task['uuid'] for task in tasks
        ])

Seems to work.

@ralphbean
Copy link
Collaborator

Cool - I ran into the same thing but couldn't find a workaround.. I ended up filing a bug on taskwarrior here -> https://bug.tasktools.org/browse/TW-1498

Can you submit that as a pull request?

@ralphbean
Copy link
Collaborator

Ah, yeah. That's the problem (now that I think about it).

Your workaround works for trac because the primary UDA trac uses is tracurl, a string-type UDA.

Other backends use numeric UDAs, and as mentioned in TW-1498, those are still broken in task-2.4.0.

@bmbove
Copy link
Contributor Author

bmbove commented Jan 12, 2015

A pull request on here or the one for taskwarrior? The taskwarrior change I assume was purposeful for whatever rework went into 2.4.0. Just confused by the order of your comments I suppose. I only use trac, so I didn't dig deep enough to find out, but would changing that filter string in bugwarrior affect anything with a numeric UDA?

@ralphbean
Copy link
Collaborator

Sorry to not be clear.

  • Could you submit your patch as a pull-request on bugwarrior?
  • It should get things working for services with non-numeric UDAs (like trac). Other services with numeric UDAs will still be broken until the task-2.4.1 release comes out (ETA January 15th).

@ralphbean
Copy link
Collaborator

OK. task-2.4.1 is out and with it, bugwarrior-1.1.0. This should all be working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants