Giter VIP home page Giter VIP logo

todo-sync's People

Contributors

tmurph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

todo-sync's Issues

KeyError: 'id': Asana API changed from 'id' to 'gid'

@tmurph thanks for developing this tool. Are you still maintaining this repo? It looks like the Asana API changed so that expects 'gid' instead of 'id', so I hit this error when I try to use it:

$ todo-sync -v org ~/.emacs.d/init-todo-sync.el asana ASANA_TOKEN
Get From Source:
 (ts-init)

Send To Source:
 (ts-final)

Traceback (most recent call last):
  File "/home/pdblood/.local/bin/todo-sync", line 8, in <module>
    sys.exit(main())
  File "/home/pdblood/.local/lib/python3.8/site-packages/todo_sync/command_line.py", line 48, in main
    with module.ahead_source(
  File "/home/pdblood/.local/lib/python3.8/site-packages/todo_sync/mappers/org_to_asana.py", line 67, in ahead_source
    source = a.Source.from_client(client, verbose)
  File "/home/pdblood/.local/lib/python3.8/site-packages/todo_sync/backends/asana.py", line 298, in from_client
    c = cls(asana_client.users.me()['workspaces'][0]['id'],
KeyError: 'id'

If I change all the instances of 'id' to 'gid' in asana.py, it gets past this error, but then hits another one:

Send To Source:
 (ts-final)

Traceback (most recent call last):
  File "/home/pdblood/.local/bin/todo-sync", line 8, in <module>
    sys.exit(main())
  File "/home/pdblood/.local/lib/python3.8/site-packages/todo_sync/command_line.py", line 51, in main
    edit_script(b_source.get_tree(), a_source.get_tree(),
  File "/home/pdblood/.local/lib/python3.8/site-packages/todo_sync/backends/asana.py", line 403, in get_all_items
    node = self.make_task_node(task)
  File "/home/pdblood/.local/lib/python3.8/site-packages/todo_sync/backends/asana.py", line 328, in make_task_node
    return TaskNode.from_dict(
  File "/home/pdblood/.local/lib/python3.8/site-packages/todo_sync/node.py", line 17, in from_dict
    raise Exception('All Nodes must have an ID.'
Exception: All Nodes must have an ID.

{'id': None} is reserved for Root nodes.

I suspect it's a related issue, but in case I've broken something else with my quick attempt at fixing it, I figured I'd report it in case you're still interested in updating your code.

Asana synchronization fails with pexpect error

Every time I try to connect and pull down tasks from Asana I receive the following error:

$ todo-sync org ~/tmp/asana-test/config.el asana $ASANA_TOKEN

Traceback (most recent call last):
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
    return super(spawn, self).read_nonblocking(size)
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/pexpect/spawnbase.py", line 176, in read_nonblocking
    raise EOF('End Of File (EOF). Empty string style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user1/anaconda3/bin/todo-sync", line 10, in <module>
    sys.exit(main())
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/todo_sync/command_line.py", line 47, in main
    args.behind_config, args.verbose, args.dry_run) as b_source:
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/todo_sync/mappers/org_to_asana.py", line 48, in behind_source
    spawn, "Lisp expression: ", None)
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/pexpect/replwrap.py", line 55, in __init__
    self._expect_prompt()
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/pexpect/replwrap.py", line 66, in _expect_prompt
    timeout=timeout)
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/pexpect/spawnbase.py", line 418, in expect_exact
    return exp.expect_loop(timeout)
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/pexpect/expect.py", line 117, in expect_loop
    return self.eof(e)
  File "/Users/user1/anaconda3/lib/python3.6/site-packages/pexpect/expect.py", line 63, in eof
    raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.
<pexpect.pty_spawn.spawn object at 0x100eaa898>
command: /usr/local/bin/emacs
args: [b'/usr/local/bin/emacs', b'-batch', b'-l', b'/Users/user1/tmp/asana-test/config.el', b'-l', b'ts-org-interaction.el', b'--eval=(ts-repl)']
buffer (last 100 chars): ''
before (last 100 chars): '0.50/lisp/url" "/usr/local/Cellar/emacs-plus/HEAD-d2d4916/share/emacs/27.0.50/lisp/textmodes" ...)\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 83866
child_fd: 7
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
    0: 'Lisp expression: '
    1: '[PEXPECT_PROMPT+'

My org file is empty and my config file looks like:

;;; make the downloaded ts-org-interaction library available
(add-to-list load-path (expand-file-name "~/tmp/asana-test"))

;;; set Org agenda file variables
(defvar org-directory (expand-file-name "~/tmp/asana-test"))
(defvar org-agenda-files '("asana.org"))

I'm using python 3.6.8 on macos 10.13 with org-version 9.2.3.

Any idea what could be going wrong?

Error attempting to sync RuntimeError: generator raised StopIteration

I'm getting errors while trying to sync to and from an asana account.
I'm not sure what's relevant so ill try to provide all I can

I'm on mac osx using
Python 3.7.0 and GNU Emacs 25.3.1

I've cloned both this repo, and org mode inside ~/.emacs.d/vendor Ended up using org modes maint branch instead of master (with master I got complaints of missing functions in todo-sync otherwise)

I created a minimal config
cat ~/.emacs.d/todo-sync-config.el

;;; we need the downloaded version of Org
(add-to-list 'load-path "~/.emacs.d/vendor/todo-sync/emacs")
(add-to-list 'load-path "~/.emacs.d/vendor/org-mode/lisp")

;;; and we need to set Org agenda files
(defvar org-directory (expand-file-name "~/notes"))
(defvar org-agenda-files '("asanaTasks.org"))

also created a script for pushing tasks
cat push-home-tasks

#!/bin/bash
asanaToken=***
initFile="~/.emacs.d/todo-sync-config.el"
todo-sync asana $asanaToken org $initFile -v

However it throws a generator raised StopIteration

Get From Source:
 (ts-init)

Tag Find by Workspace:
 796042258360695

Send To Source:
 (ts-final)

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/asana/page_iterator.py", line 61, in items
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/todo-sync", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/todo_sync/command_line.py", line 51, in main
    edit_script(b_source.get_tree(), a_source.get_tree(),
  File "/usr/local/lib/python3.7/site-packages/todo_sync/backends/asana.py", line 345, in get_all_items
    for tag in all_tags:
RuntimeError: generator raised StopIteration

Interestingly it actually edits the task file with properties
cat asanaTasks.org

* funtimes
:PROPERTIES:
:ID:       688076AD-1A48-4DE1-9F92-F8AED2659BC6
:END:
- a note

When trying to retrieve tasks I also get an error
cat retrieve-home-tasks

#!/bin/bash
asanaToken=****
initFile="~/.emacs.d/todo-sync-config.el"
todo-sync org $initFile asana $asanaToken -v
Get From Source:
 (ts-init)

Get From Source:
 (ts-get-all-headlines '(:id :title :paragraph :parent-id :todo-type :closed :deadline :filename :tags :asana_id :asana_project_id))

Send To Source:
 (ts-final)

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 485, in read_nonblocking
    return super(spawn, self).read_nonblocking(size)
  File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 176, in read_nonblocking
    raise EOF('End Of File (EOF). Empty string style platform.')
pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/todo_sync/command_line.py", line 51, in main
    edit_script(b_source.get_tree(), a_source.get_tree(),
  File "/usr/local/lib/python3.7/site-packages/todo_sync/mappers/org_to_asana.py", line 59, in <lambda>
    ['asana_id', 'asana_project_id'])
  File "/usr/local/lib/python3.7/site-packages/todo_sync/backends/org.py", line 245, in get_all_items
    elisp_string_from_list(field_list)))
  File "/usr/local/lib/python3.7/site-packages/todo_sync/helpers.py", line 46, in wrapped_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pexpect/replwrap.py", line 95, in run_command
    if self._expect_prompt(timeout=timeout) == 1:
  File "/usr/local/lib/python3.7/site-packages/pexpect/replwrap.py", line 66, in _expect_prompt
    timeout=timeout)
  File "/usr/local/lib/python3.7/site-packages/pexpect/spawnbase.py", line 418, in expect_exact
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 117, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.7/site-packages/pexpect/expect.py", line 63, in eof
    raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.
<pexpect.pty_spawn.spawn object at 0x1027ebc88>
command: /usr/local/bin/emacs
args: [b'/usr/local/bin/emacs', b'-batch', b'-l', b'~/.emacs.d/todo-sync-config.el', b'-l', b'ts-org-interaction.el', b'--eval=(ts-repl)']
buffer (last 100 chars): ''
before (last 100 chars): 'Args out of range: "", 2, nil\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: None
flag_eof: True
pid: 24682
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_string:
    0: 'Lisp expression: '
    1: '[PEXPECT_PROMPT+'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/todo-sync", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/todo_sync/command_line.py", line 53, in main
    args.no_delete)
  File "/usr/local/lib/python3.7/site-packages/todo_sync/backends/org.py", line 211, in __exit__
    self._repl_to_source_command('(ts-final)')
  File "/usr/local/lib/python3.7/site-packages/todo_sync/helpers.py", line 46, in wrapped_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pexpect/replwrap.py", line 88, in run_command
    self.child.sendline(cmdlines[0])
  File "/usr/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 555, in sendline
    return self.send(s + self.linesep)
  File "/usr/local/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 546, in send
    return os.write(self.child_fd, b)
OSError: [Errno 5] Input/output error

Is there something silly I'm missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.