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

File watcher does not run #3

Closed
mcgoldba opened this issue May 18, 2019 · 17 comments
Closed

File watcher does not run #3

mcgoldba opened this issue May 18, 2019 · 17 comments

Comments

@mcgoldba
Copy link

After hitting Ctrl-F on a line with the figure name in my .tex file, steps 1 thru 5 execute properly, but the file watcher (step 6) does not run immediately after opening the .svg template, Vimtex returns a compile error

The :VimtexCompileOutput is:

! LaTeX Error: File `test.pdf_tex' not found.

Type X to quit or <RETURN> to proceed, 
or enter new name. (Default extension: pdf_tex)

Enter file name: 
./test.tex:24: Emergency stop.
<read *> 
         
l.24     \incfig{test}
                      ^^M                     
./test.tex:24:  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.
=== TeX engine is 'pdfTeX'
Latexmk: Errors, so I did not complete making targets 
vimtex_compiler_callback_failure

Where is the "inkscape-figures watch" command executed? Should this be added to the vim mapping?

@cuppajoeman
Copy link

cuppajoeman commented May 19, 2019

I have a similar problem.
Where/when should the inkscape watch command be executed?

@gillescastel
Copy link
Owner

When you create a figure, the watcher should normally start watching the directory.
What OS you using? What's the content of ~/.config/inkscape-figures/roots?
What happens when you execute inkscape-figures watch?

@cuppajoeman
Copy link

Hello Gilles,

This is what happens when I try to use inkscape-figures, this video also contains what roots looks like and what happens when I execute watch.

https://streamable.com/eglz4

@gillescastel
Copy link
Owner

Thanks! What I said wasn't correct. Creating a figure doesn't start the file watcher, it merely adds the folder to the list of folders that should be watched. Actually starting the watcher should be done by executing inkscape-figures watch once. I saw that the first time you executed that command, there was no output (which is expected). The second time you ran it, it gave an error about not being able to lock a pid file. This means that the file watcher is running.

Please edit and save the figure you've just created. I think (and hope) that now the script will compile the figures as expected. Please report back!

@cuppajoeman
Copy link

cuppajoeman commented May 20, 2019

Hi Gilles,

Here is a recording of what happens when I run the watcher and create the file

https://streamable.com/6ox8z

It doesn't seem to be compiling the figure correctly but it is generating the pdf_tex.

After that if I run the watcher again the output is as expected (my vim seems to glitch, but I believe that's unrelated and that usually doesn't happen)

https://streamable.com/s4owt

@mcgoldba
Copy link
Author

Thanks Gilles! I am not at a place were I can try your last recommendation, but I did look at this some more yesterday. I was able to successfully create the .pdf_tex file and compile the document without any error if I manually went back to vim after Ctrl-f opened inkscape and ran the command

.!inkscape-figures watch

After this I can edit the figure, save it, and compile the document successfully. However, If I recall correctly it requires me to manually call the watch command every time, and it doesn't work if I run this command before hitting Ctrl-f or running it directly from the console, I get the same 'pid' error (Although I may be wrong on this point). I will look into more tonight.

By the way I am running Ubuntu linux from a Acer chromebook through a crouton.

@mcgoldba
Copy link
Author

I get the same result as cuppa with your most recent suggestion. The only way I can get the figure to appear properly is if it implement the watch command after hitting Ctrl-f and before Ctrl-s in inkscape.

@cuppajoeman
Copy link

Hi Gilles,

Do you have any suggestions for when/how to run the watch command?

Thanks,
cup

@cuppajoeman
Copy link

@mcgoldba Have you come up with a workaround?

@mcgoldba
Copy link
Author

Not yet. I haven't had time to look at it recently. I did try to start the watcher with a revised vim mapping for Ctrl-f... but it didn't work. I had something like:

inoremap <C-f> <Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/" && .!inkscape-figures watch'<CR><CR>:w<CR>

@gillescastel
Copy link
Owner

What version of inkscape and python are you using? I've added some debugging options to version 1.0.1.
You can install it as follows:

pip install inkscape-figures==1.0.1

Now, if you run

LOGLEVEL=DEBUG inkscape-figures watch --no-daemon

you should get some debugging output.

Now, in another terminal, execute

inkscape-figures create "Figure 1"
inkscape-figures edit

and select "Figure 1". Upon saving, the directory should contain "figure-1.pdf_tex" or something similar.
Please attach the output of the watch command.

@cuppajoeman
Copy link

cuppajoeman commented Jun 13, 2019

Hi Gilles,

I currently am using python3.7 and am using inkscape version 0.92.3,

Here is the the output of the watch command:

INFO:inkscape-figures:Watching figures.
DEBUG:inotify.adapters:Inotify handle is (3).
DEBUG:inotify.adapters:Adding watch: [/home/c-u-p/.cs]
DEBUG:inotify.adapters:Added watch (1): [/home/c-u-poots]
INFO:inkscape-figures:Watching directories: /home/c-tex-example/figures, /home/c-u-p/My_Files/School/223
DEBUG:inotify.adapters:Adding watch: [/home/c-u-p/fi
DEBUG:inotify.adapters:Added watch (2): [/home/c-u-p
DEBUG:inotify.adapters:Adding watch: [/home/c-u-p/la
DEBUG:inotify.adapters:Added watch (3): [/home/c-u-p
DEBUG:inotify.adapters:Adding watch: [/home/c-u-p/Myk 4/figures]
DEBUG:inotify.adapters:Added watch (4): [/home/c-u-pWeek 4/figures]

Here's a video of me using inkscape figures, and the output.
https://streamable.com/fecql

@gillescastel
Copy link
Owner

It looks like everything is working just fine? Whenever you save the svg, the figure gets recompiled and the pdf_tex/pdf files get created. Is there still something that doesn't work as expected or has your problem been solved?

@mcgoldba
Copy link
Author

mcgoldba commented Jun 14, 2019

I am using Inscape 0.91 r13725.

Here is the output:

INFO:inkscape-figures:Watching figures.
DEBUG:inotify.adapters:Inotify handle is (4).
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/.config/inkscape-figures/roots]
DEBUG:inotify.adapters:Added watch (1): [/home/mcgoldba/.config/inkscape-figures/roots]
INFO:inkscape-figures:Watching directories: /home/mcgoldba/summer2019/ucsd_fund_ml/test/figures, /home/mcgoldba/summer2019/gt_dsn_opt/lecturenotes/module5/figures, /home/mcgoldba, /home/mcgoldba/test/figures, /home/mcgoldba/summer2019/gt_dsn_opt/mynotes/figures
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/summer2019/ucsd_fund_ml/test/figures]
DEBUG:inotify.adapters:Added watch (2): [/home/mcgoldba/summer2019/ucsd_fund_ml/test/figures]
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/summer2019/gt_dsn_opt/lecturenotes/module5/figures]
DEBUG:inotify.adapters:Added watch (3): [/home/mcgoldba/summer2019/gt_dsn_opt/lecturenotes/module5/figures]
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba]
DEBUG:inotify.adapters:Added watch (4): [/home/mcgoldba]
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/test/figures]
DEBUG:inotify.adapters:Added watch (5): [/home/mcgoldba/test/figures]
DEBUG:inotify.adapters:Adding watch: [/home/mcgoldba/summer2019/gt_dsn_opt/mynotes/figures]
DEBUG:inotify.adapters:Added watch (6): [/home/mcgoldba/summer2019/gt_dsn_opt/mynotes/figures]
DEBUG:inotify.adapters:Events received from epoll: ['IN_ACCESS']
DEBUG:inotify.adapters:Events received in stream: ['IN_CLOSE_WRITE']
INFO:inkscape-figures:Recompiling figure-1.svg
DEBUG:inkscape-figures:Running command:
DEBUG:inkscape-figures:inkscape --export-area-page --export-dpi 300 --export-pdf /home/mcgoldba/figure-1.pdf --export-latex /home/mcgoldba/figure-1.svg
DEBUG:inkscape-figures:Command succeeded
DEBUG:inotify.adapters:Events received from epoll: ['IN_ACCESS']
DEBUG:inotify.adapters:Events received in stream: ['IN_CLOSE_WRITE']
DEBUG:inkscape-figures:File has changed, but is nog an svg
DEBUG:inotify.adapters:Events received in stream: ['IN_CLOSE_WRITE']
DEBUG:inkscape-figures:File has changed, but is nog an svg

It seems that the .pdf_tex file is created correctly in this casea, and when I run within vim using the command with the debugger running. If I try to run without the debugger active, no .pdf_tex file is created.

@cuppajoeman
Copy link

When I run inkscape-figures watch, in a terminal somewhere else, and then start editing my document and adding figures it works!
I believe I have the same behavior as mcgoldba as if I don't have inkscape-figures watchin running somewhere, the pdf_tex is not generated.

@rieunity

This comment has been minimized.

@gillescastel
Copy link
Owner

Closing this issue as it looks like it is working for most people. If anyone still has similar problems, feel free to open a new issue.

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

4 participants