Open tenllado opened 4 years ago
For the part about the too quickly removed file there is a script in the wiki I think using inotify to deal with processes that fork and exit. For the second question I don't remember exactly if there is a key binding, we don't have a convenient way to bind python plugins to keys yet.
lør. 25. apr. 2020, 09:49 skrev Christian Tenllado <notifications@github.com
:
I have recently installed astroid, and I am liking it a lot. It is being a very good experience. But I am having some troubles with some html mails (as always), for which links are not opened in the browser when clicked. If I configure astroid to open the html part on a external browser, setting open_html_part_external to true, not matter if I use xdg-open or firefox, the browser does not find the file that should be opened. A new tab on Firefox is opened on a file:/// url, for a file in ~/.cache/astroid/ that does not exist. I have monitored the folder with:
watch -n0,1 "ls -l ~/.cache/astroid"
and I can confirm that the file appears but quickly disappears. What is even more strange is that if I do open the html part for a second time (enter on it again) the link is opened in the browser correctly. So I have to open twice the html part to be able to see it on the browser (two tabs, one with the wrong/removed file, the other shows the mail).
The version of astroid I am using is the 0.15 from debian unstable, backported to stable (I guess that is 0.15 with three debian revisions). I have tried before with the stable version (0.14), same behavior. I would appreciate any help to solve this issue.
As a suggestion, I would like to have a key binding to choose to open the html part on an external browser, i.e. decide to open the html parts on astroid by default if I want to, but still be able to open one selected html part on a browser using a keybinding. Is this by the way already possible? Is there any python function I can bind to a key to select to open the selected html part on an external browser?
Thank you very much for your work on this project, it is great.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/astroidmail/astroid/issues/681, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN362OFV45KT4B6BBUEADROKIZFANCNFSM4MQUMTQQ .
Thanks a lot, this really helped me, although the script from the wiki is not robust. The problem is that the file is opened and closed before firefox opens it. I am not sure of what xdg-open is doing, but it has to detect the file type and then choose the application to handle that kind of file. A simple method for that would be to use file --mime-type, and that opens and closes the file. I modified the script in the following way:
inotifywait -e close $1 &
ip=$!
xdg-open "$1"
# wait for first close
wait $ip
inotifywait -e close $1 &
ip=$!
# wait for a second close
wait $ip
This works on my system, at least for some examples tested. It is not perfect, because the second inotifywait could be executed too late and then it would wait forever. I will try to see if that happens. Another solution (tested) is to insert a sleep after the xdg-open, to give firefox some time to open and read the file.
I don't know if it is possible to wait for repeated events, say wait for two close events on a file, that would be a better solution.
Another approach would be to remove the cache files on astroid open/close, that would probably more robust.
Thank you very much for your help.
I have recently installed astroid, and I am liking it a lot. It is being a very good experience. But I am having some troubles with some html mails (as always), for which links are not opened in the browser when clicked. If I configure astroid to open the html part on a external browser, setting open_html_part_external to true, not matter if I use xdg-open or firefox, the browser does not find the file that should be opened. A new tab on Firefox is opened on a file:/// url, for a file in ~/.cache/astroid/ that does not exist. I have monitored the folder with:
watch -n0,1 "ls -l ~/.cache/astroid"
and I can confirm that the file appears but quickly disappears. What is even more strange is that if I do open the html part for a second time (enter on it again) the link is opened in the browser correctly. So I have to open twice the html part to be able to see it on the browser (two tabs, one with the wrong/removed file, the other shows the mail).
The version of astroid I am using is the 0.15 from debian unstable, backported to stable (I guess that is 0.15 with three debian revisions). I have tried before with the stable version (0.14), same behavior. I would appreciate any help to solve this issue.
As a suggestion, I would like to have a key binding to choose to open the html part on an external browser, i.e. decide to open the html parts on astroid by default if I want to, but still be able to open one selected html part on a browser using a keybinding. Is this by the way already possible? Is there any python function I can bind to a key to select to open the selected html part on an external browser?
Thank you very much for your work on this project, it is great.