alot
alot copied to clipboard
Mailto via iTerm2 produces Errno 2
Before you submit a bug report, please make sure that the issue still exists on the master branch!
Describe the bug
I have iTerm2 on macos 10.13.6 set as the default handler for mailto
links. It opens a new terminal window and runs the following command /usr/local/bin/alot compose $$RES$$
with $$RES$$
pulling the recipient's address from the URL. A new window opens with the alot compose prompt, but once I put in a subject and hit enter, I receive this error [Errno 2] No such file or directory
The debug log doesn't show anything (see below).
Does alot need an interactive shell for this? I am able to get past this error by setting iTerm to take the mailto
link, open a new interactive shell, and run /usr/local/bin/alot compose
as "sent text," but the iTerm documentation is bad and I don't think there is a way to pass the URL or stripped recipient address to this "sent text."
Software Versions
- Python version: 2.7.15
- Alot version: .7
To Reproduce Steps to reproduce the behaviour:
- click on
mailto
link in web - fill in subject line and hit enter
- See error:
[Errno 2] No such file or directory
Error Log
DEBUG:ui:fire first command
DEBUG:ui:global command string: "compose [email protected]"
DEBUG:__init__:mode:global got commandline "compose [email protected]"
DEBUG:__init__:ARGS: [u'compose', u'[email protected]']
DEBUG:__init__:cmd parms {'spawn': None, 'sender': None, 'tags': None, 'cc': None, 'omit_signature': False, 'rest': [u'[email protected]'], 'bcc': None, 'to': None, 'template': None, 'attach': None, 'subject': None}
DEBUG:envelope:TEMPLATE: None
DEBUG:ui:Got key (['enter'], [10])
DEBUG:ui:Got key (['enter'], [10])
DEBUG:globals:SUBJECT: ""
DEBUG:globals:No encryption by default, encrypt_by_default=none
INFO:envelope:editable headers: set(['To', 'From', 'Subject'])
DEBUG:globals:using editor_cmd: nvim '+noh' '+set ft=mail' '+set fileencoding=utf-8' '+set enc=utf-8' '+set ff=unix' '+set fo+=w' '+set backupdir=~/.local/share/alot/nvim-backup'
DEBUG:globals:{'spawn: ': True, 'in_thread': True}
DEBUG:globals:{'spawn': True}
DEBUG:globals:cmdlist: ['nvim', '+noh', '+set ft=mail', '+set fileencoding=utf-8', '+set enc=utf-8', '+set ff=unix', '+set fo+=w', '+set backupdir=~/.local/share/alot/nvim-backup', '/var/folders/fq/4dvgv68120xb_n1kykws75400000gn/T/alot.k4sZvl.eml']
INFO:globals:calling external command: ['nvim', '+noh', '+set ft=mail', '+set fileencoding=utf-8', '+set enc=utf-8', '+set ff=unix', '+set fo+=w', '+set backupdir=~/.local/share/alot/nvim-backup', '/var/folders/fq/4dvgv68120xb_n1kykws75400000gn/T/alot.k4sZvl.eml']
DEBUG:ui:Got key (['q'], [113])
DEBUG:ui:cmdline: 'exit'
DEBUG:ui:global command string: "exit"
DEBUG:__init__:mode:global got commandline "exit"
DEBUG:__init__:ARGS: [u'exit']
DEBUG:__init__:cmd parms {}
DEBUG:globals:flush complete
I have no osx and iterm2 available. Is there a stack trace together with the errno2 message? Can you post that as well. I don't see any stack trace in the log you posted.
That's all that's in the alot debug log. Does alot / python log the stack trace somewhere else? Or do I have to run my own traceback on alot to catch this?
No I mean the terminal screen. After you quit alot there might some text on terminal. If you have a stack trace there that could help.
Does the editor open? The log looks like it tries to open the editor but does not receive any file back. Does the temp folder where the temp file should be exists? Does the temp file exist while the editor is open?
When I hit q
and exit alot, the terminal window closes immediately, so I don't know if there is a trace there. I'll see if I can get it to stay open (a quick search makes it seem like the method I'm using can't keep a window open once the log-in command exits).
The editor doesn't open. The temp directory is there but no corresponding temp file is created---so this could be the file in question. The main eml file itself is created and just has the To, From, and Subject lines.
I'll open an issue at iTerm to see if they can help me debug further. Thanks for the help, I realize I need more info before going forward.
I decided to try this again with a new version of alot and got a different error: UnboundLocalError: local variable 'proc' referenced before assignment
. Any ideas?
Details:
iTerm2 3.2.0 on macos 10.13.6
alot 0.8.1 with python 3.7.4_1
opening alot via a mailto link (with iTerm2 set as default handler in macos) in a new non-login shell with the following command
/usr/local/bin/alot -d debug -l ~/alot.debug compose $$RES$$
gives me the standard alot compose new mail screens, first "From:me@me..." then "Subject:" then the error pops up, which is caught in the log. Then it quits and the terminal window closes.
Debug log. Is the "compose to" address, which seems to be correctly parsed as an arg, supposed to end up under "to" in the following "cmd_params" line? Currently it is at the end as "rest"
INFO:utils:Unknown values were found in `/Users/hgv/.config/alot/config`. Please check for typos if a specified setting does not seem to work:
bindings: search
bindings: envelope
bindings: thread
DEBUG:manager:template directory: `/Users/hgv/.config/alot/templates`
DEBUG:manager:themes directory: `/Users/hgv/.config/alot/themes`
WARNING:manager:Theme `/Users/hgv/.config/alot/themes/solarized_light` does not exist.
INFO:utils:Unknown values were found in `/usr/local/share/alot/themes/solarized_light`. Please check for typos if a specified setting does not seem to work:
16_base03
16_base02
16_base01
16_base00
16_base0
16_base1
16_base2
16_base3
16_yellow
16_orange
16_red
16_magenta
16_violet
16_blue
16_cyan
16_green
256_base03
256_base02
256_base01
256_base00
256_base0
256_base1
256_base2
256_base3
256_yellow
256_orange
256_red
256_magenta
256_violet
256_blue
256_cyan
256_green
DEBUG:manager:abook defined: {'type': 'shellcommand', 'command': 'notmuch address --format=json --output=recipients date:1Y.. AND from:bauchner', 'regexp': '\\[?{"name": "(?P<name>.*)", "address": "(?P<email>.+)", "name-addr": ".*"}[,\\]]?', 'shellcommand_external_filtering': False, 'ignorecase': True, 'abook_contacts_file': '/Users/hgv/.abook/addressbook'}
DEBUG:manager:abook defined: {'type': None, 'ignorecase': True, 'command': None, 'regexp': None, 'abook_contacts_file': '/Users/hgv/.abook/addressbook', 'shellcommand_external_filtering': True}
INFO:ui:setup gui in 256 colours
DEBUG:ui:fire first command
DEBUG:ui:global command string: "compose [email protected]"
DEBUG:__init__:mode:global got commandline "compose [email protected]"
DEBUG:__init__:ARGS: ['compose', '[email protected]']
DEBUG:__init__:cmd parms {'sender': None, 'template': None, 'tags': None, 'subject': None, 'to': None, 'cc': None, 'bcc': None, 'attach': None, 'omit_signature': False, 'spawn': None, 'rest': ['[email protected]']}
DEBUG:envelope:TEMPLATE: None
DEBUG:ui:Got key (['enter'], [10])
DEBUG:ui:Got key (['enter'], [10])
DEBUG:globals:SUBJECT: ""
DEBUG:globals:No encryption by default, encrypt_by_default=none
INFO:envelope:editable headers: {'Subject', 'To', 'From'}
DEBUG:globals:using editor_cmd: nvim '+noh' '+set ft=mail' '+set fileencoding=utf-8' '+set enc=utf-8' '+set ff=unix' '+set fo+=w' '+set backupdir=/Users/hgv/.local/share/alot/nvim-backup'
DEBUG:globals:{'spawn: ': True, 'in_thread': True}
DEBUG:globals:{'spawn': True}
DEBUG:globals:cmdlist: ['nvim', '+noh', '+set ft=mail', '+set fileencoding=utf-8', '+set enc=utf-8', '+set ff=unix', '+set fo+=w', '+set backupdir=/Users/hgv/.local/share/alot/nvim-backup', '/var/folders/fq/4dvgv68120xb_n1kykws75400000gn/T/alot.7fzj9e7n.eml']
INFO:globals:calling external command: ['nvim', '+noh', '+set ft=mail', '+set fileencoding=utf-8', '+set enc=utf-8', '+set ff=unix', '+set fo+=w', '+set backupdir=/Users/hgv/.local/share/alot/nvim-backup', '/var/folders/fq/4dvgv68120xb_n1kykws75400000gn/T/alot.7fzj9e7n.eml']
ERROR:ui:Traceback (most recent call last):
File "/usr/local/Cellar/alot/0.8.1/libexec/lib/python3.7/site-packages/alot/ui.py", line 709, in apply_command
await cmd.apply(self)
File "/usr/local/Cellar/alot/0.8.1/libexec/lib/python3.7/site-packages/alot/commands/globals.py", line 356, in apply
return await ExternalCommand.apply(self, ui)
File "/usr/local/Cellar/alot/0.8.1/libexec/lib/python3.7/site-packages/alot/commands/globals.py", line 298, in apply
if proc.returncode == 0:
UnboundLocalError: local variable 'proc' referenced before assignment
DEBUG:ui:Got key (['q'], [113])
DEBUG:ui:cmdline: 'exit'
DEBUG:ui:global command string: "exit"
DEBUG:__init__:mode:global got commandline "exit"
DEBUG:__init__:ARGS: ['exit']
DEBUG:__init__:cmd parms {}
DEBUG:globals:flush complete
Thanks for reporting this. The error trace indeed indicates that the calling code in globals.py is iffy.
Regarding you immediate problem though, I believe that your editor command may be malformed or at least not interpreted as expected. Can you share this part of your config?
Also, notice the theming related error messages in your log. It seems that the theme file you're using is outdated and not compatible with the master branch any more.
Quoting hgvhgv (2020-05-16 23:02:43)
I decided to try this again with a new version of alot and got a different error: UnboundLocalError: local variable 'proc' referenced before assignment. Any ideas?
Details: iTerm2 3.2.0 on macos 10.13.6 alot 0.8.1 with python 3.7.4_1 opening alot via a mailto link (with iTerm2 set as default handler in macos) in a new non-login shell with the following command /usr/local/bin/alot -d debug -l ~/alot.debug compose $$RES$$ gives me the standard alot compose new mail screens, first "From:me@me..." then "Subject:" then the error pops up, which is caught in the log. Then it quits and the terminal window closes.
Debug log. Is the "compose to" address, which seems to be correctly parsed as an arg, supposed to end up under "to" in the following "cmd_params" line? Currently it is at the end as "rest"
INFO:utils:Unknown values were found in
/Users/hgv/.config/alot/config
. Please check for typos if a specified setting does not seem to work: bindings: search bindings: envelope bindings: thread DEBUG:manager:template directory:/Users/hgv/.config/alot/templates
DEBUG:manager:themes directory:/Users/hgv/.config/alot/themes
WARNING:manager:Theme/Users/hgv/.config/alot/themes/solarized_light
does not exist. INFO:utils:Unknown values were found in/usr/local/share/alot/themes/solarized_light
. Please check for typos if a specified setting does not seem to work: 16_base03 16_base02 16_base01 16_base00 16_base0 16_base1 16_base2 16_base3 16_yellow 16_orange 16_red 16_magenta 16_violet 16_blue 16_cyan 16_green 256_base03 256_base02 256_base01 256_base00 256_base0 256_base1 256_base2 256_base3 256_yellow 256_orange 256_red 256_magenta 256_violet 256_blue 256_cyan 256_green DEBUG:manager:abook defined: {'type': 'shellcommand', 'command': 'notmuch address --format=json --output=recipients date:1Y.. AND from:bauchner', 'regexp': '\[?{"name": "(?P.)", "address": "(?P .+)", "name-addr": ". "}[,\]]?', 'shellcommand_external_filtering': False, 'ignorecase': True, 'abook_contacts_file': '/Users/hgv/.abook/addressbook'} DEBUG:manager:abook defined: {'type': None, 'ignorecase': True, 'command': None, 'regexp': None, 'abook_contacts_file': '/Users/hgv/.abook/addressbook', 'shellcommand_external_filtering': True} INFO:ui:setup gui in 256 colours DEBUG:ui:fire first command DEBUG:ui:global command string: "compose [email protected]" DEBUG:init:mode:global got commandline "compose [email protected]" DEBUG:init:ARGS: ['compose', '[email protected]'] DEBUG:init:cmd parms {'sender': None, 'template': None, 'tags': None, 'subject': None, 'to': None, 'cc': None, 'bcc': None, 'attach': None, 'omit_signature': False, 'spawn': None, 'rest': ['[email protected]']} DEBUG:envelope:TEMPLATE: None DEBUG:ui:Got key (['enter'], [10]) DEBUG:ui:Got key (['enter'], [10]) DEBUG:globals:SUBJECT: "" DEBUG:globals:No encryption by default, encrypt_by_default=none INFO:envelope:editable headers: {'Subject', 'To', 'From'} DEBUG:globals:using editor_cmd: nvim '+noh' '+set ft=mail' '+set fileencoding=utf-8' '+set enc=utf-8' '+set ff=unix' '+set fo+=w' '+set backupdir=/Users/hgv/.local/share/alot/nvim-backup' DEBUG:globals:{'spawn: ': True, 'in_thread': True} DEBUG:globals:{'spawn': True} DEBUG:globals:cmdlist: ['nvim', '+noh', '+set ft=mail', '+set fileencoding=utf-8', '+set enc=utf-8', '+set ff=unix', '+set fo+=w', '+set backupdir=/Users/hgv/.local/share/alot/nvim-backup', '/var/folders/fq/4dvgv68120xb_n1kykws75400000gn/T/alot.7fzj9e7n.eml'] INFO:globals:calling external command: ['nvim', '+noh', '+set ft=mail', '+set fileencoding=utf-8', '+set enc=utf-8', '+set ff=unix', '+set fo+=w', '+set backupdir=/Users/hgv/.local/share/alot/nvim-backup', '/var/folders/fq/4dvgv68120xb_n1kykws75400000gn/T/alot.7fzj9e7n.eml'] ERROR:ui:Traceback (most recent call last): File "/usr/local/Cellar/alot/0.8.1/libexec/lib/python3.7/site-packages/alot/ui.py", line 709, in apply_command await cmd.apply(self) File "/usr/local/Cellar/alot/0.8.1/libexec/lib/python3.7/site-packages/alot/commands/globals.py", line 356, in apply return await ExternalCommand.apply(self, ui) File "/usr/local/Cellar/alot/0.8.1/libexec/lib/python3.7/site-packages/alot/commands/globals.py", line 298, in apply if proc.returncode == 0: UnboundLocalError: local variable 'proc' referenced before assignmentDEBUG:ui:Got key (['q'], [113]) DEBUG:ui:cmdline: 'exit' DEBUG:ui:global command string: "exit" DEBUG:init:mode:global got commandline "exit" DEBUG:init:ARGS: ['exit'] DEBUG:init:cmd parms {} DEBUG:globals:flush complete
— You are receiving this because you are subscribed to this thread. Reply to this email directly, [1]view it on GitHub, or [2]unsubscribe.
References
Visible links
- https://github.com/pazz/alot/issues/1318#issuecomment-629711726
- https://github.com/notifications/unsubscribe-auth/AAEZNZ7PPUMDGW4F7E7FF7TRR4EQHANCNFSM4FZBHNJA
My editor command is:
editor_cmd = nvim '+noh' '+set ft=mail' '+set fileencoding=utf-8' '+set enc=utf-8' '+set ff=unix' '+set fo+=w' '+set backupdir=/Users/hgv/.local/share/alot/nvim-backup'
I've had no other issues with composing directly in alot and nothing comes up in a debug file.
I did see these other debug msgs, but they haven't caused any issues since updating so I wasn't worried. Took a look at the theme file and it's the same solarized_light that was used before and seems to work fine. I'll look again when I have some more time.
Thanks for looking in to this!
Quoting hgvhgv (2020-05-17 16:15:04)
editor_cmd = nvim '+noh' '+set ft=mail' '+set fileencoding=utf-8' '+set enc=utf-8' '+set ff=unix' '+set fo+=w' '+set
Try quoting this as one string instead:
editor_cmd = "nvim +noh +set ft=mail +set fileencoding=utf-8 +set enc=utf-8 +set ff=unix +set fo+=w +set"
The individual "+set" options need to be quoted themselves, otherwise they are parsed separately and prevent the file from opening correctly in nvim (e.g., 'ft=mail'
is sent on its own, which doesn't work). I can quote the entire string and use single quotes on each '+set ft=mail'
, but this didn't change what happens with mailto.
Here's the debug on the editor_cmd in only one set of quotes.
DEBUG:globals:using editor_cmd: nvim +noh +set ft=mail +set fileencoding=utf-8 +set enc=utf-8 +set ff=unix +set fo+=w +set backupdir=/Users/hgv/.local/share/alot/nvim-backup
DEBUG:globals:{'spawn: ': True, 'in_thread': True}
DEBUG:globals:{'spawn': True}
DEBUG:globals:cmdlist: ['nvim', '+noh', '+set', 'ft=mail', '+set', 'fileencoding=utf-8', '+set', 'enc=utf-8', '+set', 'ff=unix', '+set', 'fo+=w', '+set', 'backupdir=/Users/hgv/.local/share/alot/nvim-backup', '/var/folders/fq/4dvgv68120xb_n1kykws75400000gn/T/alot.9ovkslld.eml']
INFO:globals:calling external command: ['nvim', '+noh', '+set', 'ft=mail', '+set', 'fileencoding=utf-8', '+set', 'enc=utf-8', '+set', 'ff=unix', '+set', 'fo+=w', '+set', 'backupdir=/Users/hgv/.local/share/alot/nvim-backup', '/var/folders/fq/4dvgv68120xb_n1kykws75400000gn/T/alot.9ovkslld.eml']